Changeset 4564 for exist


Ignore:
Timestamp:
08/12/08 16:23:03 (11 years ago)
Author:
cbyrom
Message:

Add CDML and CSML namespace/dtd info to use when checking file type.

Location:
exist/trunk/python/ndgUtils
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • exist/trunk/python/ndgUtils/models/Atom.py

    r4555 r4564  
    1616from ndgUtils.eXistConnector import eXistConnector 
    1717from ndgUtils.ETxmlView import et2text 
    18 from ndgUtils.lib.utilities import getTripleData, escapeSpecialCharacters, \ 
    19     tidyUpParameters, getISO8601Date, normaliseLongitude, formatDateYYYYMMDD 
     18import ndgUtils.lib.utilities as utilities 
    2019from ndgUtils.vocabtermdata import VocabTermData as VTD 
    2120from ndgUtils.models import MolesEntity as ME 
     
    6261     
    6362    def fromString(self, personString): 
    64         (self.name, self.uri, self.role) = getTripleData(personString) 
     63        (self.name, self.uri, self.role) = utilities.getTripleData(personString) 
    6564         
    6665    def fromETElement(self, personTag): 
     
    119118 
    120119    def fromString(self, linkString): 
    121         (self.href, self.title, self.rel) = getTripleData(linkString) 
     120        (self.href, self.title, self.rel) = utilities.getTripleData(linkString) 
    122121         
    123122    def fromETElement(self, linkTag): 
     
    191190        triple string are escaped (default)  
    192191        ''' 
    193         (self.label, self.scheme, self.term) = getTripleData(linkString, \ 
     192        (self.label, self.scheme, self.term) = utilities.getTripleData(linkString, \ 
    194193            doEscape=escapeSpecialCharacters) 
    195194         
     
    440439        self.ME.abbreviation = abbreviation 
    441440        self.ME.providerID = provider_id 
    442         self.ME.createdDate = getISO8601Date(object_creation_time) 
     441        self.ME.createdDate = utilities.getISO8601Date(object_creation_time) 
    443442        logging.debug('Moles entity information added') 
    444443 
     
    519518        for param in params: 
    520519            # firstly tidy parameter 
    521             param = tidyUpParameters(param) 
     520            param = utilities.tidyUpParameters(param) 
    522521            category = Category() 
    523522            # NB, data already tidied up here, so set keyword to avoid this happening again 
     
    645644        self.summary = [] 
    646645        for summary_line in summary.split('\n'): 
    647             self.summary.append(escapeSpecialCharacters(summary_line)) 
     646            self.summary.append(utilities.escapeSpecialCharacters(summary_line)) 
    648647             
    649648    Summary = property(fset=__setSummary, fget=__getSummary, doc="Atom summary") 
     
    922921                newVals = [] 
    923922                for val in attributeValue: 
    924                     newVals.append(self.objectify(escapeSpecialCharacters(val), attributeName)) 
     923                    newVals.append(self.objectify(utilities.escapeSpecialCharacters(val), attributeName)) 
    925924                attributeValue = newVals 
    926925                     
    927926            else: 
    928                 attributeValue = self.objectify(escapeSpecialCharacters(attributeValue), attributeName) 
     927                attributeValue = self.objectify(utilities.escapeSpecialCharacters(attributeValue), attributeName) 
    929928 
    930929        # handle the special case of authors; only one author is allowed per atom 
     
    10511050            return True 
    10521051        return False 
    1053  
     1052         
    10541053         
    10551054    def addCSMLData(self, csmlName, csmlContent, aggregateCoverage=False, useCSMLID=False): 
     
    10611060        directly 
    10621061        @keyword aggregateCoverage: if set to True, only coverage data that extends the 
     1062        atom coverage data will be added 
    10631063        @keyword useCSMLID: if True, use the CSML doc ID as the dataset ID - NB,  
    10641064        this should only be True if creating a new atom - e.g. from a granulite 
    1065         atom coverage data will be added 
    10661065        @return csmlDoc: the CsmlParser.Dataset object with the csml data in 
    10671066        ''' 
     
    10971096        # Firstly, extract the bounding envelope 
    10981097        if bbox1: 
    1099             w, e = normaliseLongitude(bbox1[0],bbox1[2]) 
     1098            w, e = utilities.normaliseLongitude(bbox1[0],bbox1[2]) 
    11001099            n, s = (bbox1[3], bbox1[1]) 
    11011100     
     
    11211120     
    11221121        if time: 
    1123             t1 = formatDateYYYYMMDD(time[0]) 
     1122            t1 = utilities.formatDateYYYYMMDD(time[0]) 
    11241123            if not aggregateCoverage or \ 
    11251124                (not self.t1 or datetime.datetime.strptime(t1, YEAR_FORMAT) < \ 
     
    11291128            t2 = time[1] 
    11301129            if t2 and t2 != 'None': 
    1131                 t2 = formatDateYYYYMMDD(t2) 
     1130                t2 = utilities.formatDateYYYYMMDD(t2) 
    11321131                if not aggregateCoverage or \ 
    11331132                    (not self.t2 or datetime.datetime.strptime(t2, YEAR_FORMAT) > \ 
  • exist/trunk/python/ndgUtils/ndgObject.py

    r4487 r4564  
    2626    GEOSS_NS = 'http://www.georss.org/georss/10' 
    2727    GML_NS = 'http://www.opengis.net/gml' 
     28    CSML_NS = 'http://ndg.nerc.ac.uk/csml' 
     29    CDML_DTD = 'http://www-pcmdi.llnl.gov/software/cdms/cdml.dtd' 
    2830         
    2931    # Group the doc types according to the source they should be retrieved from 
Note: See TracChangeset for help on using the changeset viewer.