Changeset 4591 for exist


Ignore:
Timestamp:
11/12/08 09:48:11 (11 years ago)
Author:
cbyrom
Message:

Correctly handle scenario where granulite files are specified online
but with no CSML/CDML file + simplify creation of CSML file.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • exist/trunk/python/ndgUtils/lib/granulite.py

    r4585 r4591  
    9191        @keyword datasetID: if using a CDML file, specify the ID of the dataset to use 
    9292        - otherwise one will be randomly generated 
    93         @return csmlDoc, cdmlDoc: the CsmlParser.Dataset object with the csml data in and,  
    94         if we're dealing with a CDML doc, return this too 
    9593        ''' 
    9694        logging.info("Creating granulite data model") 
     
    106104        # override CSML/CDML data specified in the granulite file with data input directly 
    107105        self.ingestGranuliteFiles = True 
     106        # NB, empty FieldStorage fields end up as empty strings 
    108107        if csmlOrCdmlFile is not None: 
    109             if not isinstance(csmlOrCdmlFile, cgi.FieldStorage): 
    110                 raise ValueError("Specified CSML/CDML file is not a cgi.FieldStorage object") 
    111             self.__addCSMLOrCDMLData(csmlOrCdmlFile.filename, csmlOrCdmlFile.value) 
    112108            self.ingestGranuliteFiles = False 
     109            if csmlOrCdmlFile != '': 
     110                if not isinstance(csmlOrCdmlFile, cgi.FieldStorage): 
     111                    raise ValueError("Specified CSML/CDML file is not a cgi.FieldStorage object") 
     112                self.__addCSMLOrCDMLData(csmlOrCdmlFile.filename, csmlOrCdmlFile.value) 
     113         
    113114 
    114115        if granuleAtom: 
     
    411412        fileName = fileName.split('\\')[-1] 
    412413         
    413         csmlDoc = self._atom.addCSMLData(self._csmlFileName, \ 
    414                                          self._csmlContent, useCSMLID = self.useCSMLID) 
     414        self._atom.addCSMLData(self._csmlFileName, \ 
     415                               self._csmlContent, useCSMLID = self.useCSMLID) 
    415416        logging.info("Adding CSML file to eXist") 
    416         self._eXist.createOrUpdateEXistFile(csmlDoc.toPrettyXML(), \ 
     417        self._eXist.createOrUpdateEXistFile(self._csmlContent, \ 
    417418                                        eXistConnector.NDG_A_COLLECTION_PATH + \ 
    418419                                        self._atom.ME.providerID + '/', \ 
Note: See TracChangeset for help on using the changeset viewer.