python macros aren't listed under scripting organize

since...

commit deb989dd6d1f86e74864131be50ed92d8d43768c
Author: Kenneth Koski <mechaxl@gmail.com>
Date:   Mon Feb 29 22:22:10 2016 -0600

blew away the uno.ByteSequence(str) path

Change-Id: I8b73883c4f246ebafd2f810ca61b19da40f833e2
This commit is contained in:
Caolán McNamara 2016-08-09 15:32:05 +01:00
parent 07544ac6c4
commit adb9cbff1f
2 changed files with 6 additions and 7 deletions

View File

@ -153,7 +153,7 @@ g_implName = "org.libreoffice.pyuno.LanguageScriptProviderFor"+LANGUAGENAME
BLOCK_SIZE = 65536 BLOCK_SIZE = 65536
def readTextFromStream( inputStream ): def readTextFromStream( inputStream ):
# read the file # read the file
code = uno.ByteSequence( "" ) code = uno.ByteSequence( b"" )
while True: while True:
read,out = inputStream.readBytes( None , BLOCK_SIZE ) read,out = inputStream.readBytes( None , BLOCK_SIZE )
code = code + out code = code + out
@ -549,9 +549,8 @@ class ScriptBrowseNode( unohelper.Base, XBrowseNode , XPropertySet, XInvocation,
elif event.ActionCommand == "Save": elif event.ActionCommand == "Save":
toWrite = uno.ByteSequence( toWrite = uno.ByteSequence(
str(
self.editor.getControl("EditorTextField").getText().encode( self.editor.getControl("EditorTextField").getText().encode(
sys.getdefaultencoding())) ) sys.getdefaultencoding()) )
copyUrl = self.uri + ".orig" copyUrl = self.uri + ".orig"
self.provCtx.sfa.move( self.uri, copyUrl ) self.provCtx.sfa.move( self.uri, copyUrl )
out = self.provCtx.sfa.openFileWrite( self.uri ) out = self.provCtx.sfa.openFileWrite( self.uri )

View File

@ -336,10 +336,10 @@ class TestCase( unittest.TestCase):
self.failUnlessRaises( (RuntimeException), uno.getConstantByName, "com.sun.star.uno.XInterface" ) self.failUnlessRaises( (RuntimeException), uno.getConstantByName, "com.sun.star.uno.XInterface" )
def testByteSequence( self ): def testByteSequence( self ):
s = uno.ByteSequence( "ab" ) s = uno.ByteSequence( b"ab" )
self.failUnless( s == uno.ByteSequence( "ab" ) ) self.failUnless( s == uno.ByteSequence( b"ab" ) )
self.failUnless( uno.ByteSequence( "abc" ) == s + uno.ByteSequence( "c" ) ) self.failUnless( uno.ByteSequence( b"abc" ) == s + uno.ByteSequence( b"c" ) )
self.failUnless( uno.ByteSequence( "abc" ) == s + "c" ) self.failUnless( uno.ByteSequence( b"abc" ) == s + "c" )
self.failUnless( s + "c" == "abc" ) self.failUnless( s + "c" == "abc" )
self.failUnless( s == uno.ByteSequence( s ) ) self.failUnless( s == uno.ByteSequence( s ) )
self.failUnless( s[0] == 'a' ) self.failUnless( s[0] == 'a' )