Changeset 681

Show
Ignore:
Timestamp:
06/15/08 15:42:14 (2 months ago)
Author:
sylvain
Message:

* Serialize the xml:id attribute if set on the Collection
* Added a get_collection_by_xml_id method

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • oss/amplee/amplee/atompub/collection.py

    r650 r681  
    824824            col.xml_set_attribute((qname(u'lang', XML_PREFIX), XML_NS), self.xml_lang) 
    825825 
     826        if self.xml_id: 
     827            col.xml_set_attribute((qname(u'id', XML_PREFIX), XML_NS), self.xml_id) 
     828 
    826829        col.xml_append(doc.xml_create_element(qname(u"title", ATOM10_PREFIX), 
    827830                                              ns=ATOM10_NS, attributes={u'type': u'text'}, 
  • oss/amplee/amplee/atompub/service.py

    r639 r681  
    6969            for collection in workspace.collections: 
    7070                if collection.name_or_id == name_or_id: 
     71                    return collection 
     72 
     73    def get_collection_by_xml_id(self, id): 
     74        """Returns a collection identified by C{xml:id} 
     75 
     76        @type id: string 
     77        @param id: xml:id value for the collection to be looked up 
     78        @rtype: L{AtomPubCollection} 
     79        @return: collection associated with the provided identifier 
     80        """ 
     81        for workspace in self.workspaces: 
     82            for collection in workspace.collections: 
     83                if collection.xml_id == id: 
    7184                    return collection 
    7285