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

Move existbdclient to lib package + extend to make use of DocumentRetrieve? to allow retrieval of atoms by ID + fix handling of
authors vs contributors when doing Atom to XML exports.

File:
1 edited

Legend:

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

    r4535 r4555  
    499499        ''' 
    500500        Add related links in string format - converting to Link objects 
     501        NB, only add the link if it is unique 
     502         
    501503        @param linkVals: string of format, 'uri | title | vocabServerURL' 
    502504        ''' 
    503         self.relatedLinks.append(self.objectify(linkVals, 'relatedLinks')) 
     505        link = self.objectify(linkVals, 'relatedLinks') 
     506        if link not in self.relatedLinks: 
     507            self.relatedLinks.append(link) 
    504508 
    505509 
     
    954958            obj = Link() 
    955959        elif attributeName == "atomAuthors" or attributeName == "authors": 
    956             obj = Person() 
     960            # NB, ensure there is only one author tag - extra authors are contributors 
     961            authorType = Person.AUTHOR_TYPE 
     962            if self.author: 
     963                authorType= Person.CONTRIBUTOR_TYPE 
     964            obj = Person(personType = authorType) 
    957965 
    958966        if obj: 
    959967            obj.fromString(objectVals) 
     968            # NB, need to set it now, just in case we don't set it before coming back 
     969            if attributeName == "authors" and not self.author: 
     970                self.author = obj 
    960971            return obj 
    961972         
     
    10591070        self.contentFile = csmlName 
    10601071        content = csmlContent or csmlName 
     1072     
    10611073        csmlDoc = CsmlParser.Dataset(file=content) 
    10621074         
     
    12041216            for url in urls: 
    12051217                doc = dr.get(type, dr.ATOM_TYPE, url, \ 
    1206                                             targetCollection='/db/atoms/') 
     1218                             targetCollection = eXistConnector.BASE_COLLECTION_PATH) 
    12071219                # now need to turn this results set into actual atoms 
    12081220                tree = ET.fromstring(doc) 
     
    12251237                    localID = link.href.split("__ATOM__")[-1] 
    12261238                    deploymentAtom = dr.get(self.ME.providerID, 'ATOM', localID, \ 
    1227                                             targetCollection='/db/atoms/') 
     1239                                            targetCollection = eXistConnector.BASE_COLLECTION_PATH) 
    12281240     
    12291241                deployment = Deployment.Deployment(Atom(xmlString=str(deploymentAtom))) 
Note: See TracChangeset for help on using the changeset viewer.