Package amplee :: Package atompub :: Module service :: Class AtomPubService
[hide private]
[frames] | no frames]

Class AtomPubService

source code

object --+
         |
        AtomPubService

Instance Methods [hide private]
 
__init__(self, store, xml_attrs=None)
Atom Publisging Protocol service entity.
source code
 
set_xslt(self, path) source code
 
get_workspace(self, name_or_id)
Returns a workspace per its identifier.
source code
list
get_collections(self)
Returns all the collections belonging to workspaces of this service.
source code
AtomPubCollection
get_collection(self, name_or_id)
Returns a collection identified by name_or_id
source code
AtomPubCollection
get_collection_by_uri(self, uri)
Returns a collection identified by its URI.
source code
amara.root_base
to_service(self, prefix=u'app', namespace=u'http://www.w3.org/2007/app', include_workspace_id=False)
Generates and returns a amara instance of the service document and its workspaces.
source code
amara.root_base
make_feed(self, items, entry_processor=None, id=None, title=None, xslt_path=None, member_comparer=<function app_edited_comparer at 0x88d7f44>)
Generates a new atom feed from the passed items dictionnary.
source code

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, store, xml_attrs=None)
(Constructor)

source code 
Atom Publisging Protocol service entity.
Parameters:
  • store (AtomPubStore) - AtomPubStore instance or None
  • xml_attrs (dict) - allows for XML attributes to be provided: lang, base
Overrides: object.__init__

get_workspace(self, name_or_id)

source code 
Returns a workspace per its identifier.
Parameters:
  • name_or_id (string) - matches the workspace attribute of the same name.

get_collections(self)

source code 
Returns all the collections belonging to workspaces of this service.
Returns: list
the list of AtomPubCollection belonging to this service.

get_collection(self, name_or_id)

source code 
Returns a collection identified by name_or_id
Parameters:
  • name_or_id (string) - identifier for the collection to be looked up
Returns: AtomPubCollection
collection associated with the provided identifier

get_collection_by_uri(self, uri)

source code 
Returns a collection identified by its URI.
Parameters:
  • uri (string) - absolute URI of the collection.
Returns: AtomPubCollection
collection associated with the provided identifier

to_service(self, prefix=u'app', namespace=u'http://www.w3.org/2007/app', include_workspace_id=False)

source code 
Generates and returns a amara instance of the service document and its workspaces.
Parameters:
  • prefix (string) - XML prefix to use
  • namespace (string) - namespace associated with the service document
  • include_workspace_id (bool) - if you want the name_or_id attribute value as xml:id of the {app:workspace} element, set this to True.
Returns: amara.root_base
amara instance of the service document

make_feed(self, items, entry_processor=None, id=None, title=None, xslt_path=None, member_comparer=<function app_edited_comparer at 0x88d7f44>)

source code 
Generates a new atom feed from the passed items dictionnary.
Parameters:
  • items (dict) - {collection_name: [member_ids,]} as returned for instance by the Store.list_members method.
  • entry_processor (callable) - callable that takes a member instance as parameter and returns a amara.root_base representing the entry after being processed. Useful for instance to transform the entry into a more public face.
  • id (string) - id of the feed and if not provided a urn:uuid will be generated.
  • xslt_path (string) - if provided it will be inserted as a processing instruction.
  • member_comparer (callable) - used to compare two entries when they are sorted within. By default they are sorted by app:edited element.
Returns: amara.root_base
an amara instance representing the Atom feed.