You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by pf...@apache.org on 2012/08/07 03:50:40 UTC

svn commit: r1370098 [1/2] - in /incubator/ooo/symphony/trunk/main: l10ntools/scripts/tool/ pyuno/ pyuno/demo/ pyuno/source/loader/ pyuno/source/module/ sc/workben/celltrans/ scripting/examples/python/ scripting/examples/python/pythonSamples/ scripting...

Author: pfg
Date: Tue Aug  7 01:50:39 2012
New Revision: 1370098

URL: http://svn.apache.org/viewvc?rev=1370098&view=rev
Log:
Bring some harmless Python cleaunps from trunk.

Merge revisions 1366479, 1367810, 1366950, 1367813, 1367816, 1367829,
		1367858

Modified:
    incubator/ooo/symphony/trunk/main/l10ntools/scripts/tool/const.py
    incubator/ooo/symphony/trunk/main/l10ntools/scripts/tool/l10ntool.py
    incubator/ooo/symphony/trunk/main/l10ntools/scripts/tool/pseudo.py
    incubator/ooo/symphony/trunk/main/l10ntools/scripts/tool/sdf.py
    incubator/ooo/symphony/trunk/main/l10ntools/scripts/tool/xhtex.py
    incubator/ooo/symphony/trunk/main/l10ntools/scripts/tool/xtxex.py
    incubator/ooo/symphony/trunk/main/pyuno/   (props changed)
    incubator/ooo/symphony/trunk/main/pyuno/demo/biblioaccess.py
    incubator/ooo/symphony/trunk/main/pyuno/demo/hello_world_comp.py
    incubator/ooo/symphony/trunk/main/pyuno/demo/ooextract.py
    incubator/ooo/symphony/trunk/main/pyuno/demo/swritercomp.py
    incubator/ooo/symphony/trunk/main/pyuno/demo/swritercompclient.py
    incubator/ooo/symphony/trunk/main/pyuno/source/loader/pythonloader.py
    incubator/ooo/symphony/trunk/main/pyuno/source/module/pyuno.cxx
    incubator/ooo/symphony/trunk/main/pyuno/source/module/pyuno_callable.cxx
    incubator/ooo/symphony/trunk/main/pyuno/source/module/pyuno_module.cxx
    incubator/ooo/symphony/trunk/main/pyuno/source/module/pyuno_runtime.cxx
    incubator/ooo/symphony/trunk/main/pyuno/source/module/uno.py
    incubator/ooo/symphony/trunk/main/pyuno/source/module/unohelper.py
    incubator/ooo/symphony/trunk/main/sc/workben/celltrans/parse.py
    incubator/ooo/symphony/trunk/main/scripting/examples/python/Capitalise.py
    incubator/ooo/symphony/trunk/main/scripting/examples/python/pythonSamples/TableSample.py
    incubator/ooo/symphony/trunk/main/scripting/source/pyprov/pythonscript.py
    incubator/ooo/symphony/trunk/main/solenv/bin/pchdelta.py
    incubator/ooo/symphony/trunk/main/toolkit/src2xml/source/boxer.py
    incubator/ooo/symphony/trunk/main/toolkit/src2xml/source/expression.py
    incubator/ooo/symphony/trunk/main/toolkit/src2xml/source/globals.py
    incubator/ooo/symphony/trunk/main/toolkit/src2xml/source/macroparser.py
    incubator/ooo/symphony/trunk/main/toolkit/src2xml/source/src2xml.py
    incubator/ooo/symphony/trunk/main/toolkit/src2xml/source/srclexer.py
    incubator/ooo/symphony/trunk/main/toolkit/src2xml/source/srcparser.py

Modified: incubator/ooo/symphony/trunk/main/l10ntools/scripts/tool/const.py
URL: http://svn.apache.org/viewvc/incubator/ooo/symphony/trunk/main/l10ntools/scripts/tool/const.py?rev=1370098&r1=1370097&r2=1370098&view=diff
==============================================================================
--- incubator/ooo/symphony/trunk/main/l10ntools/scripts/tool/const.py (original)
+++ incubator/ooo/symphony/trunk/main/l10ntools/scripts/tool/const.py Tue Aug  7 01:50:39 2012
@@ -35,5 +35,3 @@ class _const:
 
 import sys
 sys.modules[__name__] = _const()
-
-

Modified: incubator/ooo/symphony/trunk/main/l10ntools/scripts/tool/l10ntool.py
URL: http://svn.apache.org/viewvc/incubator/ooo/symphony/trunk/main/l10ntools/scripts/tool/l10ntool.py?rev=1370098&r1=1370097&r2=1370098&view=diff
==============================================================================
--- incubator/ooo/symphony/trunk/main/l10ntools/scripts/tool/l10ntool.py (original)
+++ incubator/ooo/symphony/trunk/main/l10ntools/scripts/tool/l10ntool.py Tue Aug  7 01:50:39 2012
@@ -36,9 +36,9 @@ import shutil
 class AbstractL10nTool:
     _options            = {}
     _args               = ""
-    _resource_type      = "" 
+    _resource_type      = ""
     _source_language    = "en-US"
-   
+
     ##### Implement these abstract methods
 
     ##### Nameing scheme for the output files
@@ -64,9 +64,9 @@ class AbstractL10nTool:
     ################### Extract a single File ######################################################
     def extract_file(self, inputfile):
         pass
-    
+
     ################################################################################################
-     
+
     def format_outputfile(self, filename, language):
         extension = filename[filename.rfind('.')+1:]
         file = filename[:filename.rfind('.')]
@@ -84,26 +84,26 @@ class AbstractL10nTool:
             return ""
         else:
             return self._options.outputfile[:self._options.outputfile.rfind('/')]
-            
+
     def merge(self,  sdfdata):
         langset,forcedset, foundset = PseudoSet(), PseudoSet() , PseudoSet()
 
-        if self._options.languages:       
-            langset = PseudoSet(self._options.languages)  
-        if self._options.forcedlanguages: 
-            forcedset = PseudoSet(self._options.forcedlanguages) 
-        if sdfdata.get_languages_found_in_sdf(): 
-            foundset = sdfdata.get_languages_found_in_sdf() 
-    
-        if self.has_multi_inputfiles(): 
+        if self._options.languages:
+            langset = PseudoSet(self._options.languages)
+        if self._options.forcedlanguages:
+            forcedset = PseudoSet(self._options.forcedlanguages)
+        if sdfdata.get_languages_found_in_sdf():
+            foundset = sdfdata.get_languages_found_in_sdf()
+
+        if self.has_multi_inputfiles():
             filelist = self.read_inputfile_list()
         else:
             filelist = self._options.inputfile
-            
+
         for inputfile in filelist:
             ref = self.parse_file(inputfile)
             # Don't write that files if there is no l10n present
-            if ((langset & foundset) - forcedset):  # all langs given and found in sdf without enforced 
+            if ((langset & foundset) - forcedset):  # all langs given and found in sdf without enforced
                 [self.merge_file(inputfile,self.format_outputfile(inputfile, lang), ref, lang, False, sdfdata) for lang in ((langset & foundset) - forcedset)]
             # Always write those files even if there is no l10n available
             if forcedset: # all enforced langs
@@ -111,15 +111,15 @@ class AbstractL10nTool:
             # In case a big file have to be written
             if ((langset & foundset) | forcedset): # all langs given ,found in sdf and enforced ones
                 self.merge_one_big_file(inputfile, self.format_outputfile(inputfile, lang), ref, ((langset & foundset) | forcedset), sdfdata)
-    
-    def has_multi_inputfiles(self): 
+
+    def has_multi_inputfiles(self):
         return self._options.inputfile[0] == '@'
 
     def copy_file(self, inputfilename, outputfilename):
-        try: 
+        try:
             os.remove(outputfilename)
         except:
-            pass    
+            pass
 
         try:
             os.remove(outputfilename)
@@ -131,7 +131,7 @@ class AbstractL10nTool:
         except IOError:
             print "ERROR: Can not copy file '" + inputfilename + "' to " + "'" + outputfilename + "'"
             sys.exit(-1)
-    
+
     def extract(self):
         try:
             f = open(self._options.outputfile, "w+")
@@ -140,7 +140,7 @@ class AbstractL10nTool:
             print "ERROR: Can not write file " + self._options.outputfile
         else:
             f.close()
-            
+
     # Parse the common options
     def parse_options(self):
         parser = OptionParser()
@@ -153,19 +153,19 @@ class AbstractL10nTool:
         parser.add_option("-r", "--projectroot",     dest="project_root",    metavar="PATH", help=""                              )
         parser.add_option("-f", "--forcedlanguages", dest="forcedlanguages", metavar="ISOCODE[,ISOCODE]", help="Always merge those langs even if no l10n is available for those langs" )
         parser.add_option("-l", "--languages",       dest="languages",       metavar="ISOCODE[,ISOCODE]", help="Merge those langs if l10n is found for each")
-        parser.add_option("-s", "--pattern",         dest="pattern",         metavar="", help=""                                  )        
+        parser.add_option("-s", "--pattern",         dest="pattern",         metavar="", help=""                                  )
         parser.add_option("-q", "--quiet",           action="store_true",    dest="quietmode", help="",default=False)
         (self._options, self.args) = parser.parse_args()
-        
+
         # -l "de,pr,pt-BR" => [ "de" , "pt" , "pt-BR" ]
         parse_complex_arg = lambda arg: arg.split(",")
-        
-        if self._options.forcedlanguages: 
-            self._options.forcedlanguages = parse_complex_arg(self._options.forcedlanguages) 
-        if self._options.languages:       
-            self._options.languages = parse_complex_arg(self._options.languages) 
+
+        if self._options.forcedlanguages:
+            self._options.forcedlanguages = parse_complex_arg(self._options.forcedlanguages)
+        if self._options.languages:
+            self._options.languages = parse_complex_arg(self._options.languages)
         self.test_options()
-        
+
     def __init__(self):
         self.parse_options()
         if self._options.input_sdf_file != None and len(self._options.input_sdf_file):
@@ -189,7 +189,7 @@ class AbstractL10nTool:
             except IOError:
                 print "Error: Can not create dir " + dir
                 sys.exit(-1)
-            
+
     def test_options(self):
         opt = self._options
         is_valid = lambda x: x != None and len(x) > 0
@@ -199,7 +199,7 @@ class AbstractL10nTool:
                 ( is_valid(opt.inputfile) and is_valid(opt.outputFile)) ))))
         print "Strange options ..."
         sys.exit( -1 )
-                     
+
     def read_inputfile_list(self):
         if self.has_multi_inputfiles():
             lines = []
@@ -212,9 +212,8 @@ class AbstractL10nTool:
             else:
                 f.close()
             return lines
-        
+
     def get_filename_string(self, inputfile):
         absfile = os.path.realpath(os.path.abspath(inputfile))
-        absroot = os.path.realpath(os.path.abspath(self._options.project_root)) 
+        absroot = os.path.realpath(os.path.abspath(self._options.project_root))
         return absfile[len(absroot)+1:].replace('/','\\')
-    

Modified: incubator/ooo/symphony/trunk/main/l10ntools/scripts/tool/pseudo.py
URL: http://svn.apache.org/viewvc/incubator/ooo/symphony/trunk/main/l10ntools/scripts/tool/pseudo.py?rev=1370098&r1=1370097&r2=1370098&view=diff
==============================================================================
--- incubator/ooo/symphony/trunk/main/l10ntools/scripts/tool/pseudo.py (original)
+++ incubator/ooo/symphony/trunk/main/l10ntools/scripts/tool/pseudo.py Tue Aug  7 01:50:39 2012
@@ -25,12 +25,12 @@
 #
 #*************************************************************************
 
-# to support macosx baseline machines from Cretaceous period 
+# to support macosx baseline machines from Cretaceous period
 
 # incomplete set() class implementation of Python 2.4
 class PseudoSet:
     _list = []
-   
+
     def __str__(self):
         return str(self._list)
 
@@ -62,10 +62,10 @@ class PseudoSet:
             return PseudoSet(tmplist)
         else:
             print "__and__(None)"
-                    
+
     def __iter__(self):
         return self._list.__iter__()
-    
+
     def __items__(self):
         return self._list.items()
 
@@ -73,16 +73,16 @@ class PseudoSet:
         return keys(self._list)
 
     def _remove_dupes(self, list):
-        tmpdict = {} 
+        tmpdict = {}
         for key in list:
             tmpdict[key] = 1
         return tmpdict.keys()
 
-# incomplete OrderedDict() class implementation 
+# incomplete OrderedDict() class implementation
 class PseudoOrderedDict(dict):
     _keylist        = []
     _valuelist      = []
-    
+
     def __init__(self, defaults={}):
         dict.__init__(self)
         for n,v in defaults.items():
@@ -92,7 +92,7 @@ class PseudoOrderedDict(dict):
         self._keylist.append(key)
         self._valuelist.append(value)
         return dict.__setitem__(self, key, value)
-        
+
     def __delattr__(self, key):
         self._keylist.__delattr__(key)
         self._valuelist.__delattr__(dict[key])
@@ -102,17 +102,17 @@ class PseudoOrderedDict(dict):
         self._keylist.__delitem__(key)
         self._valuelist.__delitem__(dict[key])
         return dict.__delitem__(self, key)
-        
+
     def __iter__(self):
         raise NotImplementedError("__iter__")
-    
+
     def __iterkeys__(self):
         return self._keylist
-    
+
     def iteritems(self):
         #return self._valuelist
         return zip(self._keylist, self._valuelist)
-   
+
     def items(self):
         return zip(self._keylist,self._valuelist)
 
@@ -124,15 +124,15 @@ class PseudoOrderedDict(dict):
 
     def __keysattr__(self):
         return self._keylist
-    
+
     def pop(self, key):
         self._keylist.pop(key)
         self._valuelist.pop(key)
         return dict.__pop__(self, key)
-    
+
     def popitem(self):
         raise NotImplementedError("popitem")
-    
+
 def _testdriver_set():
     list, list1 = [] ,[]
     list.append("a")

Modified: incubator/ooo/symphony/trunk/main/l10ntools/scripts/tool/sdf.py
URL: http://svn.apache.org/viewvc/incubator/ooo/symphony/trunk/main/l10ntools/scripts/tool/sdf.py?rev=1370098&r1=1370097&r2=1370098&view=diff
==============================================================================
--- incubator/ooo/symphony/trunk/main/l10ntools/scripts/tool/sdf.py (original)
+++ incubator/ooo/symphony/trunk/main/l10ntools/scripts/tool/sdf.py Tue Aug  7 01:50:39 2012
@@ -32,35 +32,35 @@ class SdfData:
     _filename        = "";
     _dict            = PseudoOrderedDict()
     _languages_found = [];
-    
+
     def __init__ (self, filename=""):
         self._filename = filename
-    
+
     def __getitem__(self, key):
         if self._dict.has_key(key):
             return self._dict[key]
         else:
             return None
-    
+
     def has_key(self, key):
         return self._dict.has_key(key)
-    
+
     def __setitem__(self, key, value):
         self._dict[key] = value
-    
+
     def get_languages_found_in_sdf(self):
         return PseudoSet(self._languages_found)
 
     def read(self):
         try:
             f = open(self._filename, "r")
-            lines = [line.rstrip('\n') for line in f.readlines()] 
+            lines = [line.rstrip('\n') for line in f.readlines()]
         except IOError:
             print "ERROR: Trying to read "+ self._filename
             raise
         else:
             f.close()
-        for line in lines:        
+        for line in lines:
             entity = SdfEntity()
             entity.set_properties(line)
             self._dict[entity.get_id()] = entity
@@ -68,7 +68,7 @@ class SdfData:
 
     def write(self, filename):
         try:
-            f = open(filename, "w+") 
+            f = open(filename, "w+")
             for value in self._dict.itervalues():
                 #f.write( repr(value)+"\n" )
                 f.write(value + "\n")
@@ -79,7 +79,7 @@ class SdfData:
             f.close()
 
 import sys
-class SdfEntity: 
+class SdfEntity:
     # Sdf format columns
     project         = ""
     source_file     = ""
@@ -96,7 +96,7 @@ class SdfEntity: 
     quickhelptext   = ""
     title           = ""
     date            = ""
-    
+
     import const
     const._PROJECT_POS         = 0
     const._SOURCE_FILE_POS     = 1
@@ -113,8 +113,8 @@ class SdfEntity: 
     const._QUICKHELPTEXT_POS   = 12
     const._TITLE_POS           = 13
     const._DATE_POS            = 14
-        
-    def __init__(self, project="", source_file="", dummy1="0", resource_type="", gid="", lid="", helpid="", platform="", dummy2="0", langid="", 
+
+    def __init__(self, project="", source_file="", dummy1="0", resource_type="", gid="", lid="", helpid="", platform="", dummy2="0", langid="",
                        text="", helptext="", quickhelptext="", title="", date=""):
         self.project        = project;
         self.source_file    = source_file;
@@ -139,32 +139,32 @@ class SdfEntity: 
     def set_properties(self, line):
         splitted = line.split("\t")
         if len(splitted) == 15:
-            self.project        = splitted[ self.const._PROJECT_POS ]             
-            self.source_file    = splitted[ self.const._SOURCE_FILE_POS ]     
-            self.dummy1         = splitted[ self.const._DUMMY1_POS ]         
-            self.resource_type  = splitted[ self.const._RESOURCE_TYPE_POS ] 
-            self.gid            = splitted[ self.const._GID_POS ]             
-            self.lid            = splitted[ self.const._LID_POS ]             
-            self.helpid         = splitted[ self.const._HELPID_POS ]         
-            self.platform       = splitted[ self.const._PLATFORM_POS ]         
-            self.dummy2         = splitted[ self.const._DUMMY2_POS ]         
-            self.langid         = splitted[ self.const._LANGID_POS ]         
-            self.text           = splitted[ self.const._TEXT_POS ]             
-            self.helptext       = splitted[ self.const._HELPTEXT_POS ]         
-            self.quickhelptext  = splitted[ self.const._QUICKHELPTEXT_POS ] 
-            self.title          = splitted[ self.const._TITLE_POS ]         
-            self.date           = splitted[ self.const._DATE_POS ]            
+            self.project        = splitted[ self.const._PROJECT_POS ]
+            self.source_file    = splitted[ self.const._SOURCE_FILE_POS ]
+            self.dummy1         = splitted[ self.const._DUMMY1_POS ]
+            self.resource_type  = splitted[ self.const._RESOURCE_TYPE_POS ]
+            self.gid            = splitted[ self.const._GID_POS ]
+            self.lid            = splitted[ self.const._LID_POS ]
+            self.helpid         = splitted[ self.const._HELPID_POS ]
+            self.platform       = splitted[ self.const._PLATFORM_POS ]
+            self.dummy2         = splitted[ self.const._DUMMY2_POS ]
+            self.langid         = splitted[ self.const._LANGID_POS ]
+            self.text           = splitted[ self.const._TEXT_POS ]
+            self.helptext       = splitted[ self.const._HELPTEXT_POS ]
+            self.quickhelptext  = splitted[ self.const._QUICKHELPTEXT_POS ]
+            self.title          = splitted[ self.const._TITLE_POS ]
+            self.date           = splitted[ self.const._DATE_POS ]
 
     def get_file_id(self):
         return self.project + "\\" + self.source_file
-    
+
     def get_resource_path(self):
-            return self.source_file[0:self.source_file.rfind( "\\" )-1]
-    
+        return self.source_file[0:self.source_file.rfind( "\\" )-1]
+
     def __str__(self):
-        return ''.join([self.project, "\t", self.source_file, "\t", self.dummy1, "\t", self.resource_type, "\t" , 
-            self.gid, "\t", self.lid, "\t", self.helpid, "\t", self.platform, "\t", self.dummy2, "\t" , self.langid, 
+        return ''.join([self.project, "\t", self.source_file, "\t", self.dummy1, "\t", self.resource_type, "\t" ,
+            self.gid, "\t", self.lid, "\t", self.helpid, "\t", self.platform, "\t", self.dummy2, "\t" , self.langid,
             "\t", self.text, "\t", self.helptext, "\t", self.quickhelptext, "\t" , self.title, "\t", self.date ])
-    
+
     def get_id(self):
         return ''.join([self.project, self.gid, self.lid, self.source_file, self.resource_type, self.platform, self.helpid, self.langid])

Modified: incubator/ooo/symphony/trunk/main/l10ntools/scripts/tool/xhtex.py
URL: http://svn.apache.org/viewvc/incubator/ooo/symphony/trunk/main/l10ntools/scripts/tool/xhtex.py?rev=1370098&r1=1370097&r2=1370098&view=diff
==============================================================================
--- incubator/ooo/symphony/trunk/main/l10ntools/scripts/tool/xhtex.py (original)
+++ incubator/ooo/symphony/trunk/main/l10ntools/scripts/tool/xhtex.py Tue Aug  7 01:50:39 2012
@@ -31,25 +31,25 @@ import sys
 import xml.dom.minidom
 
 class Xhtex(AbstractL10nTool):
-    _resource_type = "xht" 
+    _resource_type = "xht"
     _sdfdata       = ()
     _lang          = ""
-   
+
     # Extract methods
     def extract_topic(self, list, inputfile):
         topics = []
-        for elem in list:                        
+        for elem in list:
             if elem.childNodes[0].nodeType == elem.TEXT_NODE and len(elem.childNodes[0].data.strip()):
-                topics.append(self.prepare_sdf_line(id=elem.getAttribute("id").strip(), text=elem.childNodes[0].data, inputfile=inputfile))            
+                topics.append(self.prepare_sdf_line(id=elem.getAttribute("id").strip(), text=elem.childNodes[0].data, inputfile=inputfile))
         return topics
-            
+
     def extract_title(self, list, inputfile):
         titles = []
         for elem in list:
             if len(elem.getAttribute("title").strip()):
                 titles.append(self.prepare_sdf_line(id=elem.getAttribute("id").strip(), text=elem.getAttribute("title").strip(), inputfile=inputfile))
         return titles
-    
+
     # Merge methods
     def merge_topic(self, list, sdfdata, lang, inputfilename, dom):
         for elem in list:
@@ -58,17 +58,17 @@ class Xhtex(AbstractL10nTool):
                 if sdfdata[obj.get_id()]:
                     elem.childNodes[0].data = unicode(str(sdfdata[obj.get_id()].text),"utf8")
 
-                
+
     def merge_title(self, list, sdfdata, lang, inputfilename):
         for elem in list:
             obj = self.prepare_sdf_line(inputfile=inputfilename, lang=lang, id=elem.getAttribute("id").strip())
-            if elem.getAttribute("id").strip() and sdfdata[obj.get_id()]: 
+            if elem.getAttribute("id").strip() and sdfdata[obj.get_id()]:
                 elem.setAttribute("title", unicode(str(sdfdata[obj.get_id()].text),"utf8"))
 
-    # L10N tool       
+    # L10N tool
     def __init__(self):
         AbstractL10nTool.__init__(self)
-        
+
     def parse_file(self, filename):
         document = ""
         try:
@@ -81,16 +81,16 @@ class Xhtex(AbstractL10nTool):
             f.close()
         return xml.dom.minidom.parseString(document)
 
-        
+
     def merge_file(self, inputfilename, outputfilename, parsed_file_ref, lang,is_forced_lang, sdfdata):
-        if lang == "en-US":             
-            mod_outputfilename = outputfilename.replace("_en-US",'')            
+        if lang == "en-US":
+            mod_outputfilename = outputfilename.replace("_en-US",'')
             self.make_dirs(mod_outputfilename)
             self.copy_file(inputfilename, mod_outputfilename)
             return
         dom = parsed_file_ref.cloneNode(True)
         #dom = self.parse_file(inputfilename)    # in case cloneNode is buggy just parse it always
-                
+
         self.merge_topic(dom.getElementsByTagName("topic"), sdfdata, lang, inputfilename, dom)
         self.merge_title(dom.getElementsByTagName("node"), sdfdata, lang, inputfilename)
         self.merge_title(dom.getElementsByTagName("help_section"), sdfdata, lang, inputfilename)
@@ -104,7 +104,7 @@ class Xhtex(AbstractL10nTool):
             sys.exit(-1)
         else:
             f.close()
-    
+
     ##### Helper for parse-once-use-often like parsing a xml file is needed implement it here
     def parse_file(self, filename):
         document = ""
@@ -114,23 +114,22 @@ class Xhtex(AbstractL10nTool):
         except IOError:
             print "ERROR: Can not read file " + filename
         else:
-            f.close()        
+            f.close()
         return xml.dom.minidom.parseString(document)
-    
+
     ##### Extract a single File
     def extract_file(self, inputfile):
         sdf_data = []
-        dom = self.parse_file(inputfile)        
+        dom = self.parse_file(inputfile)
         sdf_data.extend(self.extract_topic(dom.getElementsByTagName("topic"), inputfile))
         sdf_data.extend(self.extract_title(dom.getElementsByTagName("help_section"), inputfile))
-        sdf_data.extend(self.extract_title(dom.getElementsByTagName("node"), inputfile))        
-        return ''.join([str(line)+"\n" for line in sdf_data])                      
+        sdf_data.extend(self.extract_title(dom.getElementsByTagName("node"), inputfile))
+        return ''.join([str(line)+"\n" for line in sdf_data])
 
     def prepare_sdf_line(self, inputfile="", lang="" , id="" , text=""):
         if lang == "":
             lang = self._source_language
         return SdfEntity(project=self._options.project_name, source_file=self.get_filename_string(inputfile),
                          resource_type=self._resource_type, gid=id, lid="", langid=lang,text=text)
-        
+
 run = Xhtex()
- 

Modified: incubator/ooo/symphony/trunk/main/l10ntools/scripts/tool/xtxex.py
URL: http://svn.apache.org/viewvc/incubator/ooo/symphony/trunk/main/l10ntools/scripts/tool/xtxex.py?rev=1370098&r1=1370097&r2=1370098&view=diff
==============================================================================
--- incubator/ooo/symphony/trunk/main/l10ntools/scripts/tool/xtxex.py (original)
+++ incubator/ooo/symphony/trunk/main/l10ntools/scripts/tool/xtxex.py Tue Aug  7 01:50:39 2012
@@ -28,21 +28,21 @@
 from l10ntool import AbstractL10nTool
 from sdf import SdfEntity
 import sys
-import shutil 
+import shutil
 
 class Xtxex(AbstractL10nTool):
-    _resource_type       = "xtx" 
-       
+    _resource_type       = "xtx"
+
     def __init__(self):
         AbstractL10nTool.__init__(self)
-        
-    def merge_file(self, inputfilename, outputfilename, parsed_file_ref, lang, is_forced_lang, sdfdata): 
+
+    def merge_file(self, inputfilename, outputfilename, parsed_file_ref, lang, is_forced_lang, sdfdata):
         # Special handling for en-US files
-        if lang == "en-US":             
+        if lang == "en-US":
             mod_outputfilename = outputfilename
             # mod here if needed
             self.copy_file(inputfilename, mod_outputfilename)
-            return      
+            return
         # merge usual lang
         sdfline = self.prepare_sdf_line(inputfilename,lang)
         if sdfdata.has_key(sdfline.get_id()):
@@ -56,11 +56,11 @@ class Xtxex(AbstractL10nTool):
                 sys.exit(-1)
             else:
                 f.close()
-            return        
+            return
         # no sdf data found then copy en-US source file
         if is_forced_lang:
             self.copy_file(inputfilename, outputfilename)
-               
+
     ##### Extract a single File
     def extract_file(self, inputfile):
         lines = []
@@ -73,7 +73,7 @@ class Xtxex(AbstractL10nTool):
         else:
             f.close()
         # remove legal header
-        lines = [line for line in lines if len(line) > 0 and not line[0] == '#']        
+        lines = [line for line in lines if len(line) > 0 and not line[0] == '#']
         # escape all returns
         lines = [line.replace('\n', "\\n") for line in lines]
         line = ''.join(lines)
@@ -90,5 +90,5 @@ class Xtxex(AbstractL10nTool):
             lang = self._source_language
         return SdfEntity(project=self._options.project_name, source_file=self.get_filename_string(inputfile),
                           resource_type=self._resource_type, gid="none", lid="none", langid=lang,text="")
-         
+
 run = Xtxex()

Propchange: incubator/ooo/symphony/trunk/main/pyuno/
------------------------------------------------------------------------------
  Merged /incubator/ooo/trunk/main/pyuno:r1366479,1367858

Modified: incubator/ooo/symphony/trunk/main/pyuno/demo/biblioaccess.py
URL: http://svn.apache.org/viewvc/incubator/ooo/symphony/trunk/main/pyuno/demo/biblioaccess.py?rev=1370098&r1=1370097&r2=1370098&view=diff
==============================================================================
--- incubator/ooo/symphony/trunk/main/pyuno/demo/biblioaccess.py (original)
+++ incubator/ooo/symphony/trunk/main/pyuno/demo/biblioaccess.py Tue Aug  7 01:50:39 2012
@@ -5,9 +5,9 @@ from com.sun.star.sdb.CommandType import
 def main():
 
     connectionString = "socket,host=localhost,port=2002"
-    
+
     url = "uno:"+connectionString + ";urp;StarOffice.ComponentContext"
-    
+
     localCtx = uno.getComponentContext()
     localSmgr = localCtx.ServiceManager
     resolver = localSmgr.createInstanceWithContext(
@@ -22,12 +22,12 @@ def main():
 
     rowset.execute();
 
-    print "Identifier\tAuthor"
+    print("Identifier\tAuthor")
 
     id = rowset.findColumn( "IDENTIFIER" )
     author = rowset.findColumn( "AUTHOR" )
     while rowset.next():
-        print rowset.getString( id ) + "\t" + repr( rowset.getString( author ) )
+        print(rowset.getString( id ) + "\t" + repr( rowset.getString( author ) ))
 
 
     rowset.dispose();

Modified: incubator/ooo/symphony/trunk/main/pyuno/demo/hello_world_comp.py
URL: http://svn.apache.org/viewvc/incubator/ooo/symphony/trunk/main/pyuno/demo/hello_world_comp.py?rev=1370098&r1=1370097&r2=1370098&view=diff
==============================================================================
--- incubator/ooo/symphony/trunk/main/pyuno/demo/hello_world_comp.py (original)
+++ incubator/ooo/symphony/trunk/main/pyuno/demo/hello_world_comp.py Tue Aug  7 01:50:39 2012
@@ -9,32 +9,32 @@ class HelloWorldJob( unohelper.Base, XJo
     def __init__( self, ctx ):
         # store the component context for later use
         self.ctx = ctx
-        
+
     def trigger( self, args ):
         # note: args[0] == "HelloWorld", see below config settings
-    
+
         # retrieve the desktop object
         desktop = self.ctx.ServiceManager.createInstanceWithContext(
             "com.sun.star.frame.Desktop", self.ctx )
-	    
+
         # get current document model
         model = desktop.getCurrentComponent()
 
-	# access the document's text property
-	text = model.Text
+        # access the document's text property
+        text = model.Text
 
-	# create a cursor
-	cursor = text.createTextCursor()
+        # create a cursor
+        cursor = text.createTextCursor()
 
-	# insert the text into the document
-	text.insertString( cursor, "Hello World", 0 )
+        # insert the text into the document
+        text.insertString( cursor, "Hello World", 0 )
 
 # pythonloader looks for a static g_ImplementationHelper variable
 g_ImplementationHelper = unohelper.ImplementationHelper()
 
-# 
+#
 g_ImplementationHelper.addImplementation( \
-	HelloWorldJob,                        # UNO object class
-	"org.openoffice.comp.pyuno.demo.HelloWorld", # implemenation name 
-	("com.sun.star.task.Job",),)          # list of implemented services
-	                                      # (the only service)
+        HelloWorldJob,                        # UNO object class
+        "org.openoffice.comp.pyuno.demo.HelloWorld", # implemenation name
+        ("com.sun.star.task.Job",),)          # list of implemented services
+                                              # (the only service)

Modified: incubator/ooo/symphony/trunk/main/pyuno/demo/ooextract.py
URL: http://svn.apache.org/viewvc/incubator/ooo/symphony/trunk/main/pyuno/demo/ooextract.py?rev=1370098&r1=1370097&r2=1370098&view=diff
==============================================================================
--- incubator/ooo/symphony/trunk/main/pyuno/demo/ooextract.py (original)
+++ incubator/ooo/symphony/trunk/main/pyuno/demo/ooextract.py Tue Aug  7 01:50:39 2012
@@ -9,18 +9,18 @@ from com.sun.star.uno import Exception a
 from com.sun.star.io import IOException,XInputStream, XOutputStream
 
 class OutputStream( Base, XOutputStream ):
-      def __init__( self ):
-	  self.closed = 0
-	  
-      def closeOutput(self):
-	  self.closed = 1
-
-      def writeBytes( self, seq ):
-	  sys.stdout.write( seq.value )
-
-      def flush( self ):
-	  pass
-      
+    def __init__( self ):
+        self.closed = 0
+
+    def closeOutput(self):
+        self.closed = 1
+
+    def writeBytes( self, seq ):
+        sys.stdout.write( seq.value )
+
+    def flush( self ):
+        pass
+
 
 def main():
     retVal = 0
@@ -39,12 +39,12 @@ def main():
                 url = "uno:" + a + ";urp;StarOffice.ComponentContext"
             if o == "--html":
                 filterName = "HTML (StarWriter)"
-            
-        print filterName
+
+        print(filterName)
         if not len( args ):
-              usage()
-              sys.exit()
-              
+            usage()
+            sys.exit()
+
         ctxLocal = uno.getComponentContext()
         smgrLocal = ctxLocal.ServiceManager
 
@@ -69,25 +69,25 @@ def main():
                     raise UnoException( "Couldn't open stream for unknown reason", None )
 
                 doc.storeToURL("private:stream",outProps)
-            except IOException, e:
+            except IOException as e:
                 sys.stderr.write( "Error during conversion: " + e.Message + "\n" )
                 retVal = 1
-            except UnoException, e:
+            except UnoException as e:
                 sys.stderr.write( "Error ("+repr(e.__class__)+") during conversion:" + e.Message + "\n" )
                 retVal = 1
             if doc:
                 doc.dispose()
 
-    except UnoException, e:
+    except UnoException as e:
         sys.stderr.write( "Error ("+repr(e.__class__)+") :" + e.Message + "\n" )
         retVal = 1
-    except getopt.GetoptError,e:
+    except getopt.GetoptError as e:
         sys.stderr.write( str(e) + "\n" )
         usage()
         retVal = 1
 
     sys.exit(retVal)
-    
+
 def usage():
     sys.stderr.write( "usage: ooextract.py --help |\n"+
                   "       [-c <connection-string> | --connection-string=<connection-string>\n"+
@@ -106,4 +106,4 @@ def usage():
                   "        Instead of the text filter, the writer html filter is used\n"
                   )
 
-main()    
+main()

Modified: incubator/ooo/symphony/trunk/main/pyuno/demo/swritercomp.py
URL: http://svn.apache.org/viewvc/incubator/ooo/symphony/trunk/main/pyuno/demo/swritercomp.py?rev=1370098&r1=1370097&r2=1370098&view=diff
==============================================================================
--- incubator/ooo/symphony/trunk/main/pyuno/demo/swritercomp.py (original)
+++ incubator/ooo/symphony/trunk/main/pyuno/demo/swritercomp.py Tue Aug  7 01:50:39 2012
@@ -21,92 +21,92 @@ def insertTextIntoCell( table, cellName,
 # implementing the interface com.sun.star.lang.XMain
 # unohelper.Base implements the XTypeProvider interface
 class SWriterComp(XMain,unohelper.Base):
-      def __init__( self, ctx ):
-	  self.ctx = ctx
+    def __init__( self, ctx ):
+        self.ctx = ctx
 
-      # implementation for XMain.run( [in] sequence< any > )	  
-      def run( self,args ):
+    # implementation for XMain.run( [in] sequence< any > )
+    def run( self,args ):
 
-	 ctx = self.ctx
-	 smgr = ctx.ServiceManager
-	 desktop = smgr.createInstanceWithContext( "com.sun.star.frame.Desktop",ctx)
+        ctx = self.ctx
+        smgr = ctx.ServiceManager
+        desktop = smgr.createInstanceWithContext( "com.sun.star.frame.Desktop",ctx)
 
-	 # open a writer document
-	 doc = desktop.loadComponentFromURL( "private:factory/swriter","_blank", 0, () )
+        # open a writer document
+        doc = desktop.loadComponentFromURL( "private:factory/swriter","_blank", 0, () )
 
-	 text = doc.Text
-	 cursor = text.createTextCursor()
-	 text.insertString( cursor, "The first line in the newly created text document.\n", 0 )
-	 text.insertString( cursor, "Now we are in the second line\n" , 0 )
+        text = doc.Text
+        cursor = text.createTextCursor()
+        text.insertString( cursor, "The first line in the newly created text document.\n", 0 )
+        text.insertString( cursor, "Now we are in the second line\n" , 0 )
 
-	 # create a text table
-	 table = doc.createInstance( "com.sun.star.text.TextTable" )
+        # create a text table
+        table = doc.createInstance( "com.sun.star.text.TextTable" )
 
-	 # with 4 rows and 4 columns
-	 table.initialize( 4,4)
+        # with 4 rows and 4 columns
+        table.initialize( 4,4)
 
-	 text.insertTextContent( cursor, table, 0 )
-	 rows = table.Rows
+        text.insertTextContent( cursor, table, 0 )
+        rows = table.Rows
 
-	 table.setPropertyValue( "BackTransparent", uno.Bool(0) )
-	 table.setPropertyValue( "BackColor", 13421823 )
-	 row = rows.getByIndex(0)
-	 row.setPropertyValue( "BackTransparent", uno.Bool(0) )
-	 row.setPropertyValue( "BackColor", 6710932 )
+        table.setPropertyValue( "BackTransparent", uno.Bool(0) )
+        table.setPropertyValue( "BackColor", 13421823 )
+        row = rows.getByIndex(0)
+        row.setPropertyValue( "BackTransparent", uno.Bool(0) )
+        row.setPropertyValue( "BackColor", 6710932 )
 
-	 textColor = 16777215
+        textColor = 16777215
 
-	 insertTextIntoCell( table, "A1", "FirstColumn", textColor )
-	 insertTextIntoCell( table, "B1", "SecondColumn", textColor )
-	 insertTextIntoCell( table, "C1", "ThirdColumn", textColor )
-	 insertTextIntoCell( table, "D1", "SUM", textColor )
+        insertTextIntoCell( table, "A1", "FirstColumn", textColor )
+        insertTextIntoCell( table, "B1", "SecondColumn", textColor )
+        insertTextIntoCell( table, "C1", "ThirdColumn", textColor )
+        insertTextIntoCell( table, "D1", "SUM", textColor )
 
-	 values = ( (22.5,21.5,121.5),
-	 	   (5615.3,615.3,-615.3),
-		   (-2315.7,315.7,415.7) )
-         table.getCellByName("A2").setValue(22.5)
-	 table.getCellByName("B2").setValue(5615.3)
-	 table.getCellByName("C2").setValue(-2315.7)
-	 table.getCellByName("D2").setFormula("sum <A2:C2>")
+        values = ( (22.5,21.5,121.5),
+                  (5615.3,615.3,-615.3),
+                  (-2315.7,315.7,415.7) )
+        table.getCellByName("A2").setValue(22.5)
+        table.getCellByName("B2").setValue(5615.3)
+        table.getCellByName("C2").setValue(-2315.7)
+        table.getCellByName("D2").setFormula("sum <A2:C2>")
 
-	 table.getCellByName("A3").setValue(21.5)
-	 table.getCellByName("B3").setValue(615.3)
-	 table.getCellByName("C3").setValue(-315.7)
-	 table.getCellByName("D3").setFormula("sum <A3:C3>")
+        table.getCellByName("A3").setValue(21.5)
+        table.getCellByName("B3").setValue(615.3)
+        table.getCellByName("C3").setValue(-315.7)
+        table.getCellByName("D3").setFormula("sum <A3:C3>")
 
-	 table.getCellByName("A4").setValue(121.5)
-	 table.getCellByName("B4").setValue(-615.3)
-	 table.getCellByName("C4").setValue(415.7)
-	 table.getCellByName("D4").setFormula("sum <A4:C4>")
+        table.getCellByName("A4").setValue(121.5)
+        table.getCellByName("B4").setValue(-615.3)
+        table.getCellByName("C4").setValue(415.7)
+        table.getCellByName("D4").setFormula("sum <A4:C4>")
 
 
-	 cursor.setPropertyValue( "CharColor", 255 )
-	 cursor.setPropertyValue( "CharShadowed", uno.Bool(1) )
+        cursor.setPropertyValue( "CharColor", 255 )
+        cursor.setPropertyValue( "CharShadowed", uno.Bool(1) )
 
-	 text.insertControlCharacter( cursor, PARAGRAPH_BREAK, 0 )
-	 text.insertString( cursor, " This is a colored Text - blue with shadow\n" , 0 )
-	 text.insertControlCharacter( cursor, PARAGRAPH_BREAK, 0 )
+        text.insertControlCharacter( cursor, PARAGRAPH_BREAK, 0 )
+        text.insertString( cursor, " This is a colored Text - blue with shadow\n" , 0 )
+        text.insertControlCharacter( cursor, PARAGRAPH_BREAK, 0 )
 
-	 textFrame = doc.createInstance( "com.sun.star.text.TextFrame" )
-	 textFrame.setSize( Size(15000,400))
-	 textFrame.setPropertyValue( "AnchorType" , AS_CHARACTER )
+        textFrame = doc.createInstance( "com.sun.star.text.TextFrame" )
+        textFrame.setSize( Size(15000,400))
+        textFrame.setPropertyValue( "AnchorType" , AS_CHARACTER )
 
-	 text.insertTextContent( cursor, textFrame, 0 )
+        text.insertTextContent( cursor, textFrame, 0 )
 
-	 textInTextFrame = textFrame.getText()
-	 cursorInTextFrame = textInTextFrame.createTextCursor()
-	 textInTextFrame.insertString( cursorInTextFrame, "The first line in the newly created text frame.", 0 )
-	 textInTextFrame.insertString( cursorInTextFrame, "\nWith this second line the height of the rame raises.",0)
-	 text.insertControlCharacter( cursor, PARAGRAPH_BREAK, 0 )
+        textInTextFrame = textFrame.getText()
+        cursorInTextFrame = textInTextFrame.createTextCursor()
+        textInTextFrame.insertString( cursorInTextFrame, "The first line in the newly created text frame.", 0 )
+        textInTextFrame.insertString( cursorInTextFrame, "\nWith this second line the height of the rame raises.",0)
+        text.insertControlCharacter( cursor, PARAGRAPH_BREAK, 0 )
 
-	 cursor.setPropertyValue( "CharColor", 65536 )
-	 cursor.setPropertyValue( "CharShadowed", uno.Bool(0) )
+        cursor.setPropertyValue( "CharColor", 65536 )
+        cursor.setPropertyValue( "CharShadowed", uno.Bool(0) )
 
-	 text.insertString( cursor, " That's all for now !!" , 0 )
-	 return 0
+        text.insertString( cursor, " That's all for now !!" , 0 )
+        return 0
 
 
 # pythonloader looks for a static g_ImplementationHelper variable
 g_ImplementationHelper = unohelper.ImplementationHelper()
 g_ImplementationHelper.addImplementation( \
-	SWriterComp,"org.openoffice.comp.pyuno.swriter",("org.openoffice.demo.SWriter",),)
+        SWriterComp,"org.openoffice.comp.pyuno.swriter",("org.openoffice.demo.SWriter",),)

Modified: incubator/ooo/symphony/trunk/main/pyuno/demo/swritercompclient.py
URL: http://svn.apache.org/viewvc/incubator/ooo/symphony/trunk/main/pyuno/demo/swritercompclient.py?rev=1370098&r1=1370097&r2=1370098&view=diff
==============================================================================
--- incubator/ooo/symphony/trunk/main/pyuno/demo/swritercompclient.py (original)
+++ incubator/ooo/symphony/trunk/main/pyuno/demo/swritercompclient.py Tue Aug  7 01:50:39 2012
@@ -3,11 +3,10 @@ import uno
 
 localContext = uno.getComponentContext()
 resolver = localContext.ServiceManager.createInstanceWithContext(
-				"com.sun.star.bridge.UnoUrlResolver", localContext )
+                                "com.sun.star.bridge.UnoUrlResolver", localContext )
 remoteContext = resolver.resolve( "uno:socket,host=localhost,port=2002;urp;StarOffice.ComponentContext" )
 remoteSmgr = remoteContext.ServiceManager
 
 pyComp = remoteSmgr.createInstanceWithContext( "org.openoffice.demo.SWriter" , remoteContext )
 
 pyComp.run( (), )
-

Modified: incubator/ooo/symphony/trunk/main/pyuno/source/loader/pythonloader.py
URL: http://svn.apache.org/viewvc/incubator/ooo/symphony/trunk/main/pyuno/source/loader/pythonloader.py?rev=1370098&r1=1370097&r2=1370098&view=diff
==============================================================================
--- incubator/ooo/symphony/trunk/main/pyuno/source/loader/pythonloader.py (original)
+++ incubator/ooo/symphony/trunk/main/pyuno/source/loader/pythonloader.py Tue Aug  7 01:50:39 2012
@@ -44,112 +44,110 @@ g_supportedServices  = "com.sun.star.loa
 g_implementationName = "org.openoffice.comp.pyuno.Loader" # referenced by the native C++ loader !
 
 def splitUrl( url ):
-      nColon = url.find( ":" )
-      if -1 == nColon:
-            raise RuntimeException( "PythonLoader: No protocol in url " + url, None )
-      return url[0:nColon], url[nColon+1:len(url)]
+    nColon = url.find( ":" )
+    if -1 == nColon:
+        raise RuntimeException( "PythonLoader: No protocol in url " + url, None )
+    return url[0:nColon], url[nColon+1:len(url)]
 
 g_loadedComponents = {}
 def checkForPythonPathBesideComponent( url ):
-      path = unohelper.fileUrlToSystemPath( url+"/pythonpath.zip" );
-      if DEBUG == 1:
-            print "checking for existence of " + encfile( path )
-      if 1 == os.access( encfile( path ), os.F_OK) and not path in sys.path:
-            if DEBUG == 1:
-                  print "adding " + encfile( path ) + " to sys.path"
-            sys.path.append( path )
-
-      path = unohelper.fileUrlToSystemPath( url+"/pythonpath" );
-      if 1 == os.access( encfile( path ), os.F_OK) and not path in sys.path:
-            if DEBUG == 1:
-                  print "adding " + encfile( path ) + " to sys.path"
-            sys.path.append( path )
+    path = unohelper.fileUrlToSystemPath( url+"/pythonpath.zip" );
+    if DEBUG == 1:
+        print("checking for existence of " + encfile( path ))
+    if 1 == os.access( encfile( path ), os.F_OK) and not path in sys.path:
+        if DEBUG == 1:
+            print("adding " + encfile( path ) + " to sys.path")
+        sys.path.append( path )
+
+    path = unohelper.fileUrlToSystemPath( url+"/pythonpath" );
+    if 1 == os.access( encfile( path ), os.F_OK) and not path in sys.path:
+        if DEBUG == 1:
+            print("adding " + encfile( path ) + " to sys.path")
+        sys.path.append( path )
 
 def encfile(uni):
     return uni.encode( sys.getfilesystemencoding())
 
 class Loader( XImplementationLoader, XServiceInfo, unohelper.Base ):
-      def __init__(self, ctx ):
-	  if DEBUG:
-	     print "pythonloader.Loader ctor" 
-	  self.ctx = ctx
-
-      def getModuleFromUrl( self, url ):
-          if DEBUG:
-                print "pythonloader: interpreting url " +url
-          protocol, dependent = splitUrl( url )
-          if "vnd.sun.star.expand" == protocol:
-                exp = self.ctx.getValueByName( "/singletons/com.sun.star.util.theMacroExpander" )
-                url = exp.expandMacros(dependent)
-                protocol,dependent = splitUrl( url )
-
-          if DEBUG:
-                print "pythonloader: after expansion " +protocol +":" + dependent
-                
-          try:
-                if "file" == protocol:
-                      # remove \..\ sequence, which may be useful e.g. in the build env
-                      url = unohelper.absolutize( url, url )
-
-                      # did we load the module already ?
-                      mod = g_loadedComponents.get( url )
-                      if not mod:
-                            mod = imp.new_module("uno_component")
-
-                            # check for pythonpath.zip beside .py files
-                            checkForPythonPathBesideComponent( url[0:url.rfind('/')] )
-                            
-                            # read the file
-                            filename = unohelper.fileUrlToSystemPath( url )
-                            fileHandle = file( filename )
-                            src = fileHandle.read().replace("\r","")
-                            if not src.endswith( "\n" ):
-                                  src = src + "\n"
-
-                            # compile and execute the module
-                            codeobject = compile( src, encfile(filename), "exec" )
-                            exec codeobject in mod.__dict__
-                            mod.__file__ = encfile(filename)
-                            g_loadedComponents[url] = mod
-                      return mod
-                elif "vnd.openoffice.pymodule" == protocol:
-                      return  __import__( dependent )
-                else:
-                      raise RuntimeException( "PythonLoader: Unknown protocol " +
-                                              protocol + " in url " +url, self )
-          except ImportError, e:
-                raise RuntimeException( "Couldn't load "+url+ " for reason "+str(e), None)
-          return None
-	   
-      def activate( self, implementationName, dummy, locationUrl, regKey ):
-	  if DEBUG:
-	     print "pythonloader.Loader.activate"
-
-	  mod = self.getModuleFromUrl( locationUrl )
-          implHelper = mod.__dict__.get( "g_ImplementationHelper" , None )
-          if implHelper == None:
-		return mod.getComponentFactory( implementationName, self.ctx.ServiceManager, regKey )
-          else:
-		return implHelper.getComponentFactory( implementationName,regKey,self.ctx.ServiceManager)
-	     
-      def writeRegistryInfo( self, regKey, dummy, locationUrl ):
-	  if DEBUG:
-	     print "pythonloader.Loader.writeRegistryInfo"
-             
-	  mod = self.getModuleFromUrl( locationUrl )
-          implHelper = mod.__dict__.get( "g_ImplementationHelper" , None )
-          if implHelper == None:
-	        return mod.writeRegistryInfo( self.ctx.ServiceManager, regKey )
-          else:
-	        return implHelper.writeRegistryInfo( regKey, self.ctx.ServiceManager )
+    def __init__(self, ctx ):
+        if DEBUG:
+            print("pythonloader.Loader ctor")
+        self.ctx = ctx
+
+    def getModuleFromUrl( self, url ):
+        if DEBUG:
+            print("pythonloader: interpreting url " +url)
+        protocol, dependent = splitUrl( url )
+        if "vnd.sun.star.expand" == protocol:
+            exp = self.ctx.getValueByName( "/singletons/com.sun.star.util.theMacroExpander" )
+            url = exp.expandMacros(dependent)
+            protocol,dependent = splitUrl( url )
+
+        if DEBUG:
+            print("pythonloader: after expansion " +protocol +":" + dependent)
+
+        try:
+            if "file" == protocol:
+                # remove \..\ sequence, which may be useful e.g. in the build env
+                url = unohelper.absolutize( url, url )
+
+                # did we load the module already ?
+                mod = g_loadedComponents.get( url )
+                if not mod:
+                    mod = imp.new_module("uno_component")
+
+                    # check for pythonpath.zip beside .py files
+                    checkForPythonPathBesideComponent( url[0:url.rfind('/')] )
+
+                    # read the file
+                    filename = unohelper.fileUrlToSystemPath( url )
+                    fileHandle = file( filename )
+                    src = fileHandle.read().replace("\r","")
+                    if not src.endswith( "\n" ):
+                        src = src + "\n"
+
+                    # compile and execute the module
+                    codeobject = compile( src, encfile(filename), "exec" )
+                    exec(codeobject, mod.__dict__)
+                    mod.__file__ = encfile(filename)
+                    g_loadedComponents[url] = mod
+                return mod
+            elif "vnd.openoffice.pymodule" == protocol:
+                return  __import__( dependent )
+            else:
+                raise RuntimeException( "PythonLoader: Unknown protocol " +
+                                        protocol + " in url " +url, self )
+        except ImportError as e:
+            raise RuntimeException( "Couldn't load "+url+ " for reason "+str(e), None)
+        return None
+
+    def activate( self, implementationName, dummy, locationUrl, regKey ):
+        if DEBUG:
+            print("pythonloader.Loader.activate")
+
+        mod = self.getModuleFromUrl( locationUrl )
+        implHelper = mod.__dict__.get( "g_ImplementationHelper" , None )
+        if implHelper == None:
+            return mod.getComponentFactory( implementationName, self.ctx.ServiceManager, regKey )
+        else:
+            return implHelper.getComponentFactory( implementationName,regKey,self.ctx.ServiceManager)
+
+    def writeRegistryInfo( self, regKey, dummy, locationUrl ):
+        if DEBUG:
+            print("pythonloader.Loader.writeRegistryInfo")
+
+        mod = self.getModuleFromUrl( locationUrl )
+        implHelper = mod.__dict__.get( "g_ImplementationHelper" , None )
+        if implHelper == None:
+            return mod.writeRegistryInfo( self.ctx.ServiceManager, regKey )
+        else:
+            return implHelper.writeRegistryInfo( regKey, self.ctx.ServiceManager )
 
-      def getImplementationName( self ):
-	  return g_implementationName
-
-      def supportsService( self, ServiceName ):
-	  return ServiceName in self.serviceNames
-
-      def getSupportedServiceNames( self ):
-	  return g_supportedServices
+    def getImplementationName( self ):
+        return g_implementationName
 
+    def supportsService( self, ServiceName ):
+        return ServiceName in self.serviceNames
 
+    def getSupportedServiceNames( self ):
+        return g_supportedServices

Modified: incubator/ooo/symphony/trunk/main/pyuno/source/module/pyuno.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/symphony/trunk/main/pyuno/source/module/pyuno.cxx?rev=1370098&r1=1370097&r2=1370098&view=diff
==============================================================================
--- incubator/ooo/symphony/trunk/main/pyuno/source/module/pyuno.cxx (original)
+++ incubator/ooo/symphony/trunk/main/pyuno/source/module/pyuno.cxx Tue Aug  7 01:50:39 2012
@@ -646,8 +646,7 @@ static int PyUNO_cmp( PyObject *self, Py
 
 static PyTypeObject PyUNOType =
 {
-    PyObject_HEAD_INIT (&PyType_Type)
-    0,
+    PyVarObject_HEAD_INIT(&PyType_Type, 0)
     const_cast< char * >("pyuno"),
     sizeof (PyUNO),
     0,

Modified: incubator/ooo/symphony/trunk/main/pyuno/source/module/pyuno_callable.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/symphony/trunk/main/pyuno/source/module/pyuno_callable.cxx?rev=1370098&r1=1370097&r2=1370098&view=diff
==============================================================================
--- incubator/ooo/symphony/trunk/main/pyuno/source/module/pyuno_callable.cxx (original)
+++ incubator/ooo/symphony/trunk/main/pyuno/source/module/pyuno_callable.cxx Tue Aug  7 01:50:39 2012
@@ -198,8 +198,7 @@ PyObject* PyUNO_callable_call (PyObject*
 
 static PyTypeObject PyUNO_callable_Type =
 {
-    PyObject_HEAD_INIT (&PyType_Type)
-    0,
+    PyVarObject_HEAD_INIT(&PyType_Type, 0)
     const_cast< char * >("PyUNO_callable"),
     sizeof (PyUNO_callable),
     0,

Modified: incubator/ooo/symphony/trunk/main/pyuno/source/module/pyuno_module.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/symphony/trunk/main/pyuno/source/module/pyuno_module.cxx?rev=1370098&r1=1370097&r2=1370098&view=diff
==============================================================================
--- incubator/ooo/symphony/trunk/main/pyuno/source/module/pyuno_module.cxx (original)
+++ incubator/ooo/symphony/trunk/main/pyuno/source/module/pyuno_module.cxx Tue Aug  7 01:50:39 2012
@@ -493,9 +493,18 @@ static PyObject *isInterface( PyObject *
     {
         PyObject *obj = PyTuple_GetItem( args, 0 );
         Runtime r;
+#if PY_MAJOR_VERSION >= 3
+        return PyLong_FromLong( isInterfaceClass( r, obj ) );
+#else
         return PyInt_FromLong( isInterfaceClass( r, obj ) );
+
+#endif
     }
+#if PY_MAJOR_VERSION >= 3
+    return PyLong_FromLong( 0 );
+#else
     return PyInt_FromLong( 0 );
+#endif
 }
 
 static PyObject * generateUuid( PyObject *, PyObject * )

Modified: incubator/ooo/symphony/trunk/main/pyuno/source/module/pyuno_runtime.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/symphony/trunk/main/pyuno/source/module/pyuno_runtime.cxx?rev=1370098&r1=1370097&r2=1370098&view=diff
==============================================================================
--- incubator/ooo/symphony/trunk/main/pyuno/source/module/pyuno_runtime.cxx (original)
+++ incubator/ooo/symphony/trunk/main/pyuno/source/module/pyuno_runtime.cxx Tue Aug  7 01:50:39 2012
@@ -72,8 +72,7 @@ namespace pyuno
 
 static PyTypeObject RuntimeImpl_Type =
 {
-    PyObject_HEAD_INIT (&PyType_Type)
-    0,
+    PyVarObject_HEAD_INIT(&PyType_Type, 0)
     const_cast< char * >("pyuno_runtime"),
     sizeof (RuntimeImpl),
     0,
@@ -445,7 +444,11 @@ PyRef Runtime::any2PyObject (const Any &
 	{
         sal_Int32 l = 0;
         a >>= l;
+#if PY_MAJOR_VERSION >= 3
+        return PyRef( PyLong_FromLong (l), SAL_NO_ACQUIRE );
+#else
         return PyRef( PyInt_FromLong (l), SAL_NO_ACQUIRE );
+#endif
 	}
     case typelib_TypeClass_UNSIGNED_LONG:
 	{

Modified: incubator/ooo/symphony/trunk/main/pyuno/source/module/uno.py
URL: http://svn.apache.org/viewvc/incubator/ooo/symphony/trunk/main/pyuno/source/module/uno.py?rev=1370098&r1=1370097&r2=1370098&view=diff
==============================================================================
--- incubator/ooo/symphony/trunk/main/pyuno/source/module/uno.py (original)
+++ incubator/ooo/symphony/trunk/main/pyuno/source/module/uno.py Tue Aug  7 01:50:39 2012
@@ -41,8 +41,8 @@ _g_delegatee = __builtin__.__dict__["__i
 
 def getComponentContext():
     """ returns the UNO component context, that was used to initialize the python runtime.
-    """ 
-    return _g_ctx      
+    """
+    return _g_ctx
 
 def getConstantByName( constant ):
     "Looks up the value of a idl constant by giving its explicit name"
@@ -51,7 +51,7 @@ def getConstantByName( constant ):
 def getTypeByName( typeName):
     """ returns a uno.Type instance of the type given by typeName. In case the
         type does not exist, a com.sun.star.uno.RuntimeException is raised.
-    """ 
+    """
     return pyuno.getTypeByName( typeName )
 
 def createUnoStruct( typeName, *args ):
@@ -80,7 +80,7 @@ def isInterface( obj ):
 
 def generateUuid():
     "returns a 16 byte sequence containing a newly generated uuid or guid, see rtl/uuid.h "
-    return pyuno.generateUuid()        
+    return pyuno.generateUuid()
 
 def systemPathToFileUrl( systemPath ):
     "returns a file-url for the given system path"
@@ -110,9 +110,9 @@ def setCurrentContext( newContext ):
     """
     return pyuno.setCurrentContext( newContext )
 
-        
+
 class Enum:
-    "Represents a UNO idl enum, use an instance of this class to explicitly pass a boolean to UNO" 
+    "Represents a UNO idl enum, use an instance of this class to explicitly pass a boolean to UNO"
     #typeName the name of the enum as a string
     #value    the actual value of this enum as a string
     def __init__(self,typeName, value):
@@ -148,7 +148,7 @@ class Type:
         return self.typeName.__hash__()
 
 class Bool(object):
-    """Represents a UNO boolean, use an instance of this class to explicitly 
+    """Represents a UNO boolean, use an instance of this class to explicitly
        pass a boolean to UNO.
        Note: This class is deprecated. Use python's True and False directly instead
     """
@@ -171,13 +171,13 @@ class Char:
 
     def __repr__(self):
         return "<Char instance %s>" % (self.value, )
-        
+
     def __eq__(self, that):
         if isinstance(that, (str, unicode)):
             if len(that) > 1:
                 return False
             return self.value == that[0]
-        if isinstance(that, Char):        
+        if isinstance(that, Char):
             return self.value == that.value
         return False
 
@@ -188,12 +188,12 @@ class Char:
 #    def __repr__(self):
 #        return "<ByteSequence instance %s>" % str.__repr__(self)
 
-    # for a little bit compatitbility; setting value is not possible as 
+    # for a little bit compatibility; setting value is not possible as
     # strings are immutable
 #    def _get_value(self):
 #        return self
 #
-#    value = property(_get_value)        
+#    value = property(_get_value)
 
 class ByteSequence:
     def __init__(self, value):
@@ -246,7 +246,7 @@ class Any:
 def invoke( object, methodname, argTuple ):
     "use this function to pass exactly typed anys to the callee (using uno.Any)"
     return pyuno.invoke( object, methodname, argTuple )
-    
+
 #---------------------------------------------------------------------------------------
 # don't use any functions beyond this point, private section, likely to change
 #---------------------------------------------------------------------------------------
@@ -264,56 +264,56 @@ def _uno_import( name, *optargs, **kwarg
     mod = None
     d = sys.modules
     for x in modnames:
-        if d.has_key(x):
-           mod = d[x]
+        if x in d:
+            mod = d[x]
         else:
-           mod = pyuno.__class__(x)  # How to create a module ??
+            mod = pyuno.__class__(x)  # How to create a module ??
         d = mod.__dict__
 
     RuntimeException = pyuno.getClass( "com.sun.star.uno.RuntimeException" )
     for x in fromlist:
-       if not d.has_key(x):
-          if x.startswith( "typeOf" ):
-             try: 
-                d[x] = pyuno.getTypeByName( name + "." + x[6:len(x)] )
-             except RuntimeException,e:
-                raise ImportError( "type " + name + "." + x[6:len(x)] +" is unknown" )
-          else:
-            try:
-                # check for structs, exceptions or interfaces
-                d[x] = pyuno.getClass( name + "." + x )
-            except RuntimeException,e:
-                # check for enums 
+        if x not in d:
+            if x.startswith( "typeOf" ):
                 try:
-                   d[x] = Enum( name , x )
-                except RuntimeException,e2:
-                   # check for constants
-                   try:
-                      d[x] = getConstantByName( name + "." + x )
-                   except RuntimeException,e3:
-                      # no known uno type !
-                      raise ImportError( "type "+ name + "." +x + " is unknown" )
+                    d[x] = pyuno.getTypeByName( name + "." + x[6:len(x)] )
+                except RuntimeException as e:
+                    raise ImportError( "type " + name + "." + x[6:len(x)] +" is unknown" )
+            else:
+                try:
+                    # check for structs, exceptions or interfaces
+                    d[x] = pyuno.getClass( name + "." + x )
+                except RuntimeException as e:
+                    # check for enums
+                    try:
+                        d[x] = Enum( name , x )
+                    except RuntimeException as e2:
+                        # check for constants
+                        try:
+                            d[x] = getConstantByName( name + "." + x )
+                        except RuntimeException as e3:
+                            # no known uno type !
+                            raise ImportError( "type "+ name + "." +x + " is unknown" )
     return mod
 
-# hook into the __import__ chain    
+# hook into the __import__ chain
 __builtin__.__dict__["__import__"] = _uno_import
-        
+
 # private function, don't use
 def _impl_extractName(name):
-    r = range (len(name)-1,0,-1)
+    r = list(range(len(name)-1,0,-1))
     for i in r:
         if name[i] == ".":
-           name = name[i+1:len(name)]
-           break
-    return name            
+            name = name[i+1:len(name)]
+            break
+    return name
 
 # private, referenced from the pyuno shared library
 def _uno_struct__init__(self,*args):
     if len(args) == 1 and hasattr(args[0], "__class__") and args[0].__class__ == self.__class__ :
-       self.__dict__["value"] = args[0]
+        self.__dict__["value"] = args[0]
     else:
-       self.__dict__["value"] = pyuno._createUnoStructHelper(self.__class__.__pyunostruct__,args)
-    
+        self.__dict__["value"] = pyuno._createUnoStructHelper(self.__class__.__pyunostruct__,args)
+
 # private, referenced from the pyuno shared library
 def _uno_struct__getattr__(self,name):
     return __builtin__.getattr(self.__dict__["value"],name)
@@ -325,14 +325,14 @@ def _uno_struct__setattr__(self,name,val
 # private, referenced from the pyuno shared library
 def _uno_struct__repr__(self):
     return repr(self.__dict__["value"])
-    
+
 def _uno_struct__str__(self):
     return str(self.__dict__["value"])
 
 # private, referenced from the pyuno shared library
 def _uno_struct__eq__(self,cmp):
     if hasattr(cmp,"value"):
-       return self.__dict__["value"] == cmp.__dict__["value"]
+        return self.__dict__["value"] == cmp.__dict__["value"]
     return False
 
 # referenced from pyuno shared lib and pythonscript.py
@@ -340,7 +340,7 @@ def _uno_extract_printable_stacktrace( t
     mod = None
     try:
         mod = __import__("traceback")
-    except ImportError,e:
+    except ImportError as e:
         pass
     ret = ""
     if mod:

Modified: incubator/ooo/symphony/trunk/main/pyuno/source/module/unohelper.py
URL: http://svn.apache.org/viewvc/incubator/ooo/symphony/trunk/main/pyuno/source/module/unohelper.py?rev=1370098&r1=1370097&r2=1370098&view=diff
==============================================================================
--- incubator/ooo/symphony/trunk/main/pyuno/source/module/unohelper.py (original)
+++ incubator/ooo/symphony/trunk/main/pyuno/source/module/unohelper.py Tue Aug  7 01:50:39 2012
@@ -82,7 +82,7 @@ def _propertymode_to_str( mode ):
     if PROP_ATTR_MAYBEVOID & mode:
         ret = ret + "maybevoid "
     return ret.rstrip()
-    
+
 def inspect( obj , out ):
     if isinstance( obj, uno.Type ) or \
        isinstance( obj, uno.Char ) or \
@@ -112,7 +112,7 @@ def inspect( obj , out ):
             out.write( "  " + ii.typeName + "\n" )
     else:
         out.write( "  unknown\n" )
-        
+
     access = introspection.inspect( obj )
     methods = access.getMethods( METHOD_CONCEPT_ALL )
     out.write( "Methods:\n" )
@@ -136,56 +136,56 @@ def createSingleServiceFactory( clazz, i
     return _FactoryHelper_( clazz, implementationName, serviceNames )
 
 class _ImplementationHelperEntry:
-      def __init__(self, ctor,serviceNames):
-	  self.ctor = ctor
-	  self.serviceNames = serviceNames
-	  
+    def __init__(self, ctor,serviceNames):
+        self.ctor = ctor
+        self.serviceNames = serviceNames
+
 class ImplementationHelper:
-      def __init__(self):
-	  self.impls = {}
-	  
-      def addImplementation( self, ctor, implementationName, serviceNames ):
-          self.impls[implementationName] =  _ImplementationHelperEntry(ctor,serviceNames)
-	  
-      def writeRegistryInfo( self, regKey, smgr ):
-          for i in self.impls.items():
-	      keyName = "/"+ i[0] + "/UNO/SERVICES"
-	      key = regKey.createKey( keyName )
-	      for serviceName in i[1].serviceNames:
-		  key.createKey( serviceName )
-          return 1
-
-      def getComponentFactory( self, implementationName , regKey, smgr ):
-	  entry = self.impls.get( implementationName, None )
-	  if entry == None:
-	     raise RuntimeException( implementationName + " is unknown" , None )
-	  return createSingleServiceFactory( entry.ctor, implementationName, entry.serviceNames )
-
-      def getSupportedServiceNames( self, implementationName ):
-	  entry = self.impls.get( implementationName, None )
-	  if entry == None:
-	     raise RuntimeException( implementationName + " is unknown" , None )
-	  return entry.serviceNames	     
-	  
-      def supportsService( self, implementationName, serviceName ):
-	  entry = self.impls.get( implementationName,None )
-	  if entry == None:
-	     raise RuntimeException( implementationName + " is unknown", None )
-          return serviceName in entry.serviceNames	     
+    def __init__(self):
+        self.impls = {}
+
+    def addImplementation( self, ctor, implementationName, serviceNames ):
+        self.impls[implementationName] =  _ImplementationHelperEntry(ctor,serviceNames)
+
+    def writeRegistryInfo( self, regKey, smgr ):
+        for i in list(self.impls.items()):
+            keyName = "/"+ i[0] + "/UNO/SERVICES"
+            key = regKey.createKey( keyName )
+            for serviceName in i[1].serviceNames:
+                key.createKey( serviceName )
+        return 1
+
+    def getComponentFactory( self, implementationName , regKey, smgr ):
+        entry = self.impls.get( implementationName, None )
+        if entry == None:
+            raise RuntimeException( implementationName + " is unknown" , None )
+        return createSingleServiceFactory( entry.ctor, implementationName, entry.serviceNames )
+
+    def getSupportedServiceNames( self, implementationName ):
+        entry = self.impls.get( implementationName, None )
+        if entry == None:
+            raise RuntimeException( implementationName + " is unknown" , None )
+        return entry.serviceNames
+
+    def supportsService( self, implementationName, serviceName ):
+        entry = self.impls.get( implementationName,None )
+        if entry == None:
+            raise RuntimeException( implementationName + " is unknown", None )
+        return serviceName in entry.serviceNames
+
 
-	  
 class ImplementationEntry:
-      def __init__(self, implName, supportedServices, clazz ):
-	  self.implName = implName
-	  self.supportedServices = supportedServices
-	  self.clazz = clazz
+    def __init__(self, implName, supportedServices, clazz ):
+        self.implName = implName
+        self.supportedServices = supportedServices
+        self.clazz = clazz
 
 def writeRegistryInfoHelper( smgr, regKey, seqEntries ):
     for entry in seqEntries:
         keyName = "/"+ entry.implName + "/UNO/SERVICES"
-	key = regKey.createKey( keyName )
-	for serviceName in entry.supportedServices:
-	    key.createKey( serviceName )
+        key = regKey.createKey( keyName )
+        for serviceName in entry.supportedServices:
+            key.createKey( serviceName )
 
 def systemPathToFileUrl( systemPath ):
     "returns a file-url for the given system path"
@@ -198,11 +198,11 @@ def fileUrlToSystemPath( url ):
 def absolutize( path, relativeUrl ):
     "returns an absolute file url from the given urls"
     return pyuno.absolutize( path, relativeUrl )
-        
+
 def getComponentFactoryHelper( implementationName, smgr, regKey, seqEntries ):
     for x in seqEntries:
-	if x.implName == implementationName:
-	   return createSingleServiceFactory( x.clazz, implementationName, x.supportedServices )
+        if x.implName == implementationName:
+            return createSingleServiceFactory( x.clazz, implementationName, x.supportedServices )
 
 def addComponentsToContext( toBeExtendedContext, contextRuntime, componentUrls, loaderName ):
     smgr = contextRuntime.ServiceManager
@@ -214,56 +214,56 @@ def addComponentsToContext( toBeExtended
     #   create a temporary registry
     for componentUrl in componentUrls:
         reg = smgr.createInstanceWithContext( "com.sun.star.registry.SimpleRegistry", contextRuntime )
-	reg.open( "", 0, 1 )
+        reg.open( "", 0, 1 )
         if not isWin and componentUrl.endswith( ".uno" ):  # still allow platform independent naming
             if isMac:
-               componentUrl = componentUrl + ".dylib"
+                componentUrl = componentUrl + ".dylib"
             else:
-               componentUrl = componentUrl + ".so"
+                componentUrl = componentUrl + ".so"
+
+        implReg.registerImplementation( loaderName,componentUrl, reg )
+        rootKey = reg.getRootKey()
+        implementationKey = rootKey.openKey( "IMPLEMENTATIONS" )
+        implNames = implementationKey.getKeyNames()
+        extSMGR = toBeExtendedContext.ServiceManager
+        for x in implNames:
+            fac = loader.activate( max(x.split("/")),"",componentUrl,rootKey)
+            extSMGR.insert( fac )
+        reg.close()
 
-	implReg.registerImplementation( loaderName,componentUrl, reg )
-	rootKey = reg.getRootKey()
-	implementationKey = rootKey.openKey( "IMPLEMENTATIONS" )
-	implNames = implementationKey.getKeyNames()
-	extSMGR = toBeExtendedContext.ServiceManager
-	for x in implNames:
-	    fac = loader.activate( max(x.split("/")),"",componentUrl,rootKey)
-	    extSMGR.insert( fac )
-	reg.close()
-	    	    
 # never shrinks !
 _g_typeTable = {}
 def _unohelper_getHandle( self):
-   ret = None
-   if _g_typeTable.has_key( self.__class__ ):
-     ret = _g_typeTable[self.__class__]
-   else:
-     names = {}
-     traverse = list(self.__class__.__bases__)
-     while len( traverse ) > 0:
-         item = traverse.pop()
-         bases = item.__bases__
-         if uno.isInterface( item ):
-             names[item.__pyunointerface__] = None
-         elif len(bases) > 0:
-             # the "else if", because we only need the most derived interface
-             traverse = traverse + list(bases)#
-
-     lst = names.keys()
-     types = []
-     for x in lst:
-         t = uno.getTypeByName( x )
-         types.append( t )
-         
-     ret = tuple(types) , uno.generateUuid()
-     _g_typeTable[self.__class__] = ret
-   return ret
-  
+    ret = None
+    if self.__class__ in _g_typeTable:
+        ret = _g_typeTable[self.__class__]
+    else:
+        names = {}
+        traverse = list(self.__class__.__bases__)
+        while len( traverse ) > 0:
+            item = traverse.pop()
+            bases = item.__bases__
+            if uno.isInterface( item ):
+                names[item.__pyunointerface__] = None
+            elif len(bases) > 0:
+                # the "else if", because we only need the most derived interface
+                traverse = traverse + list(bases)#
+
+        lst = list(names.keys())
+        types = []
+        for x in lst:
+            t = uno.getTypeByName( x )
+            types.append( t )
+
+        ret = tuple(types) , uno.generateUuid()
+        _g_typeTable[self.__class__] = ret
+    return ret
+
 class Base(XTypeProvider):
-      def getTypes( self ):
-	  return _unohelper_getHandle( self )[0]
-      def getImplementationId(self):
-	  return _unohelper_getHandle( self )[1]
+    def getTypes( self ):
+        return _unohelper_getHandle( self )[0]
+    def getImplementationId(self):
+        return _unohelper_getHandle( self )[1]
 
 class CurrentContext(XCurrentContext, Base ):
     """a current context implementation, which first does a lookup in the given
@@ -281,28 +281,27 @@ class CurrentContext(XCurrentContext, Ba
             return self.oldContext.getValueByName( name )
         else:
             return None
-        
+
 # -------------------------------------------------
 # implementation details
 # -------------------------------------------------
 class _FactoryHelper_( XSingleComponentFactory, XServiceInfo, Base ):
-      def __init__( self, clazz, implementationName, serviceNames ):
-	  self.clazz = clazz
-	  self.implementationName = implementationName
-	  self.serviceNames = serviceNames
-	  
-      def getImplementationName( self ):
-	  return self.implementationName
-
-      def supportsService( self, ServiceName ):
-	  return ServiceName in self.serviceNames
-
-      def getSupportedServiceNames( self ):
-	  return self.serviceNames
-
-      def createInstanceWithContext( self, context ):
-	  return self.clazz( context )
-	      
-      def createInstanceWithArgumentsAndContext( self, args, context ):
-	  return self.clazz( context, *args )
-      
+    def __init__( self, clazz, implementationName, serviceNames ):
+        self.clazz = clazz
+        self.implementationName = implementationName
+        self.serviceNames = serviceNames
+
+    def getImplementationName( self ):
+        return self.implementationName
+
+    def supportsService( self, ServiceName ):
+        return ServiceName in self.serviceNames
+
+    def getSupportedServiceNames( self ):
+        return self.serviceNames
+
+    def createInstanceWithContext( self, context ):
+        return self.clazz( context )
+
+    def createInstanceWithArgumentsAndContext( self, args, context ):
+        return self.clazz( context, *args )

Modified: incubator/ooo/symphony/trunk/main/sc/workben/celltrans/parse.py
URL: http://svn.apache.org/viewvc/incubator/ooo/symphony/trunk/main/sc/workben/celltrans/parse.py?rev=1370098&r1=1370097&r2=1370098&view=diff
==============================================================================
--- incubator/ooo/symphony/trunk/main/sc/workben/celltrans/parse.py (original)
+++ incubator/ooo/symphony/trunk/main/sc/workben/celltrans/parse.py Tue Aug  7 01:50:39 2012
@@ -72,8 +72,7 @@ class LocaleData(object):
         chars += "\"), OUString(), OUString());\n\n"
 
         # pre instantiations of localized function names.
-        funcs = self.funcList.keys()
-        funcs.sort()
+        funcs = sorted(self.funcList.keys())
         chars += "// pre instantiations of localized function names\n"
         for func in funcs:
             for item in self.funcList[func]:
@@ -201,7 +200,7 @@ class Parser(object):
         chars = "// This file has been automatically generated.  Do not hand-edit this!\n"
         for obj in localeList:
             chars += "\n" + obj.dumpCode()
-    
+
         # Write to output file.
         file = open(self.outfile, 'w')
         file.write(chars)
@@ -210,4 +209,3 @@ class Parser(object):
 if __name__=='__main__':
     parser = Parser(sys.argv)
     parser.parse()
-

Modified: incubator/ooo/symphony/trunk/main/scripting/examples/python/Capitalise.py
URL: http://svn.apache.org/viewvc/incubator/ooo/symphony/trunk/main/scripting/examples/python/Capitalise.py?rev=1370098&r1=1370097&r2=1370098&view=diff
==============================================================================
--- incubator/ooo/symphony/trunk/main/scripting/examples/python/Capitalise.py (original)
+++ incubator/ooo/symphony/trunk/main/scripting/examples/python/Capitalise.py Tue Aug  7 01:50:39 2012
@@ -5,16 +5,16 @@ def getNewString( theString ) :
         return ""
     # should we tokenize on "."?
     if theString[0].isupper() and len(theString)>=2 and theString[1].isupper() :
-	# first two chars are UC => first UC, rest LC
+        # first two chars are UC => first UC, rest LC
         newString=theString[0:1].upper() + theString[1:].lower();
     elif theString[0].isupper():
-	# first char UC => all to LC
+        # first char UC => all to LC
         newString=theString.lower()
     else: # all to UC.
         newString=theString.upper()
     return newString;
 
-def capitalisePython( ): 
+def capitalisePython( ):
     """Change the case of a selection, or current word from upper case, to first char upper case, to all lower case to upper case..."""
     import string
 
@@ -30,7 +30,7 @@ def capitalisePython( ): 
     count = xIndexAccess.getCount();
     if(count>=1):  #ie we have a selection
         i=0
-	while i < count :
+        while i < count :
             xTextRange = xIndexAccess.getByIndex(i);
             #print "string: " + xTextRange.getString();
             theString = xTextRange.getString();
@@ -53,7 +53,7 @@ def capitalisePython( ): 
                 if newString:
                     xTextRange.setString(newString);
                     xSelectionSupplier.select(xTextRange);
-	    i+= 1
+            i+= 1
 
 
 # lists the scripts, that shall be visible inside OOo. Can be omited, if

Modified: incubator/ooo/symphony/trunk/main/scripting/examples/python/pythonSamples/TableSample.py
URL: http://svn.apache.org/viewvc/incubator/ooo/symphony/trunk/main/scripting/examples/python/pythonSamples/TableSample.py?rev=1370098&r1=1370097&r2=1370098&view=diff
==============================================================================
--- incubator/ooo/symphony/trunk/main/scripting/examples/python/pythonSamples/TableSample.py (original)
+++ incubator/ooo/symphony/trunk/main/scripting/examples/python/pythonSamples/TableSample.py Tue Aug  7 01:50:39 2012
@@ -15,19 +15,19 @@ def insertTextIntoCell( table, cellName,
 
 
 def createTable():
-    """creates a new writer document and inserts a table with some data (also known as the SWriter sample)""" 
+    """creates a new writer document and inserts a table with some data (also known as the SWriter sample)"""
     ctx = uno.getComponentContext()
     smgr = ctx.ServiceManager
     desktop = smgr.createInstanceWithContext( "com.sun.star.frame.Desktop",ctx)
-    
+
     # open a writer document
     doc = desktop.loadComponentFromURL( "private:factory/swriter","_blank", 0, () )
-    
+
     text = doc.Text
     cursor = text.createTextCursor()
     text.insertString( cursor, "The first line in the newly created text document.\n", 0 )
     text.insertString( cursor, "Now we are in the second line\n" , 0 )
-    
+
     # create a text table
     table = doc.createInstance( "com.sun.star.text.TextTable" )