Ignore:
Timestamp:
25/09/08 15:26:46 (12 years ago)
Author:
cbyrom
Message:

Improve the creation of new atom entries in eXist - generating unique
IDs, and checking these, where necessary + fix update date updates +
add methods to the vocab data class to retrieve lists of data categories
+ subtypes - for use in the UI dropdowns.

File:
1 edited

Legend:

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

    r4229 r4236  
    179179 
    180180        # last update date 
    181         self.updateDate = None 
     181        self.updatedDate = None 
    182182 
    183183        # assume atom in working state by default - this is used to define what collection 
     
    195195 
    196196        # if inputs passed in as dict, add these now 
    197         self.__dict__.update(inputs) 
     197        if inputs: 
     198            self.__dict__.update(inputs) 
     199             
     200            if inputs.get('providerID'): 
     201                self.ME.providerID = inputs.get('providerID') 
     202 
    198203 
    199204        if self.atomTypeID: 
     
    222227        collectionPath += self.ME.providerID + "/" 
    223228        return collectionPath 
    224  
    225  
    226  
    227     def getValidSubTypes(self): 
    228         ''' 
    229         Get list of subtypes that are valid wrt this atom type 
    230         ''' 
    231         logging.debug("Lookup up subtypes for type, '%s'" %self.atomTypeID) 
    232         subTypes = self.VTD.SUBTYPE_TERMS.get(self.atomTypeID) or [] 
    233         types = [] 
    234         for st in subTypes: 
    235             types.append(self.VTD.TERM_DATA[st]) 
    236         logging.debug("Found subtypes: %s" %subTypes) 
    237         return types 
    238          
    239229             
    240230 
     
    408398 
    409399        updated = ET.SubElement(root, "updated") 
    410         if not self.updateDate: 
    411             self.updateDate = currentDate 
    412         updated.text = self.updateDate 
     400        if not self.updatedDate: 
     401            self.updatedDate = currentDate 
     402        updated.text = self.updatedDate 
    413403 
    414404        published = ET.SubElement(root, "published") 
     
    544534            logging.debug("Adding published date") 
    545535            self.publishedDate = publishedDate 
     536                 
     537        updatedDate = tree.findtext('updated') 
     538        if updatedDate: 
     539            logging.debug("Adding updated date") 
     540            self.updatedDate = updatedDate 
    546541             
    547542        logging.info("Completed data ingest") 
     
    604599        ''' 
    605600        self.atomName = datasetID + ".atom" 
    606         self.atomBrowseURL = VTD.BROWSE_ROOT_URL + \ 
    607             self.ME.providerID + "__ATOM__" + datasetID 
     601        self.ndgURI = self.ME.providerID + "__ATOM__" + datasetID  
     602        self.atomBrowseURL = VTD.BROWSE_ROOT_URL + self.ndgURI 
    608603 
    609604 
     
    639634        self.datasetID = self.atomBrowseURL.split("__ATOM__")[-1] 
    640635        self.atomName = self.datasetID + ".atom" 
     636        self.ndgURI = self.atomBrowseURL.split(VTD.BROWSE_ROOT_URL)[1] 
    641637         
    642638        # now remove this value and the associated moles doc link 
Note: See TracChangeset for help on using the changeset viewer.