Changeset 4249


Ignore:
Timestamp:
30/09/08 12:19:31 (11 years ago)
Author:
cbyrom
Message:

Tighten up atom data model to better handle online references + simplify
exist doc saving - don't return the updated doc as this will now be
retrieved by simply reloading the edit template.

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

Legend:

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

    r4244 r4249  
    3131 
    3232 
    33 class Person(): 
     33class Person(object): 
    3434    ''' 
    3535    Class representing atom author type data - with name, uri and role attributes 
     
    102102        return 1 
    103103 
    104 class Link(): 
     104class Link(object): 
    105105    ''' 
    106106    Class representing an atom link - with href, title and rel attributes 
    107107    ''' 
     108 
    108109    def __init__(self): 
    109110        self.href = "" 
     
    112113 
    113114    def fromString(self, linkString): 
    114         (self.href, self.title, self.ref) = getTripleData(linkString) 
     115        (self.href, self.title, self.rel) = getTripleData(linkString) 
    115116         
    116117    def fromETElement(self, linkTag): 
     
    127128 
    128129    def hasValue(self): 
    129         if self.href or self.title or self.rel: 
     130        # NB, just a rel on its own is meaningless - so ignore 
     131        if self.href or self.title: 
    130132            return True 
    131133        return False 
    132  
    133  
    134  
    135 class Category(): 
     134     
     135 
     136    def __str__(self): 
     137        if self.href or self.title or self.rel: 
     138            return self.href + " | " + self.title + " | " + self.rel 
     139        return "" 
     140 
     141 
     142class Category(object): 
    136143    ''' 
    137144    Class representing an atom category - with term, scheme and label attributes 
     
    294301            category.label = self.subtype 
    295302            # look up the appropriate vocab term data 
    296             category.scheme = self.VTD.getTermCurrentVocabURL(self.subtype) 
     303            category.scheme = self.subtype# self.VTD.getTermCurrentVocabURL(self.subtype) 
    297304            category.term = self.ATOM_SUBTYPE 
    298305            root.append(category.toXML()) 
     
    697704            if not linkData.has_key(link.rel): 
    698705                linkData[link.rel] = [] 
     706                 
    699707            if link.title == VTD.TERM_DATA[VTD.LOGO_TERM].title: 
    700708                self.logos.append(link) 
  • exist/trunk/python/ndgUtils/models/existdbclient.py

    r4240 r4249  
    287287        Create an atom in the eXist DB 
    288288        @param atom: atom object to create in the DB 
    289         @return atom: atom object saved in eXist 
    290289        ''' 
    291290        logging.info("Creating atom in eXist") 
     
    320319             
    321320        self.createEXistFile(atom.toPrettyXML(), eXistCollection, atom.atomName) 
    322              
    323321        logging.info("Atom created in eXist") 
    324         return atom 
     322        return 
Note: See TracChangeset for help on using the changeset viewer.