Changeset 335


Ignore:
Timestamp:
03/26/10 10:36:39 (10 years ago)
Author:
sander
Message:

Do not crash factory when the oooserver dies mid-conversion

Location:
trunk/factory/src/backends
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/factory/src/backends/__init__.py

    r247 r335  
    5252                self.application = config.get(section, 'application').lower() 
    5353                self.version = config.get(section, 'version').lower() 
    54                 self.doctype = config.get(section, 'doctype') 
     54                self.doctype = [s.strip() for s in config.get(section, 'doctype').split(',')] 
    5555                self.formats = [s.strip() for s in config.get(section, 'formats').split(',')] 
    5656         
     
    6868                        job['application'].lower() == self.application and 
    6969                        job['version'].lower() == self.version and 
    70                         job['doctype'] == self.doctype and 
     70                        job['doctype'] in self.doctype and 
    7171                        (job['format'] == '' or job['format'] in self.formats) 
    7272                ) 
     73 
    7374                return eligable 
    7475 
  • trunk/factory/src/backends/oooserver.py

    r172 r335  
    1616 
    1717from backends import Backend, BackendException 
     18from com.sun.star.uno import RuntimeException 
    1819from com.sun.star.beans import PropertyValue 
    1920from com.sun.star.connection import NoConnectException 
     
    122123                src_file_url = self.file_url(src_file) 
    123124                filter_name = self.filter_name(job['doctype'], job['format']) 
    124                 document = self.desktop.loadComponentFromURL(src_file_url, "_blank", 0, _unoProps(Hidden=True, ReadOnly=True, UpdateDocMode=QUIET_UPDATE)) 
    125125 
    126                 if document is None: 
    127                         raise OOOServerException("The document '%s' could not be opened." % src_file_url, True) 
     126                try: 
     127                        document = self.desktop.loadComponentFromURL(src_file_url, "_blank", 0, _unoProps(Hidden=True, ReadOnly=True, UpdateDocMode=QUIET_UPDATE)) 
    128128 
    129                 document.storeToURL(self.file_url(dst_file), _unoProps(FilterName=filter_name)) 
    130                 document.close(True) 
     129                        if document is None: 
     130                                raise OOOServerException("The document '%s' could not be opened." % src_file_url, True) 
     131 
     132                        document.storeToURL(self.file_url(dst_file), _unoProps(FilterName=filter_name)) 
     133                        document.close(True) 
     134                except RuntimeException: 
     135                        raise OOOServerException("UNO RuntimeException in OOOServer. The server probably died. Unloading backend.", False) 
    131136 
    132137                logging.info('OOOServer converted %s to %s' % (src_file, dst_file)) 
Note: See TracChangeset for help on using the changeset viewer.