| Home | Trees | Index | Help |
|
|---|
| Package amplee :: Package atompub :: Module collection :: Class AtomPubCollection |
|
object --+
|
AtomPubCollection
| Method Summary | |
|---|---|
Atom Publishing Protocol collection handler. | |
Add an initialized amplee.indexer.Indexer instance to the collection | |
Add a member to this collection by * adding it to the store * adding it to the internal cache if it is enabled You are not forced to pass the resource content through this method if you prefer storing it in a different location without using amplee. | |
Does a info belong to the store | |
Take the parameter and returns a tuple such as (member_id, media_id). | |
Dispatches the operation based for that media-type to the matching handler | |
Enable the internal cache | |
Returns the absolute URI to the collection for editing operations | |
Returns the absolute URI to the collection for media-editing operations | |
Returns the absolute URI to the collection public face | |
Returns the content of the media resource or None. | |
Constructs and returns the info to the resource pointed by the id parameter. | |
Returns a tuple (handler, memember_type) based on the provided media_type | |
Returns the requested member or None if not found. | |
Returns an object stored as meta-data information in the store for a resource. | |
Constructs and returns the info to the member pointed by the id parameter. | |
Returns the first available xml:base value from either the collection, its workspace or service. | |
Loads a member from its storage and returns it or None if not found. | |
Removes a member from a collection and the underlying stor. | |
Registers the provided handler to be available to this collection. | |
Reloads all or part of existing members. | |
Reloads members from a an atom feed. | |
Given a list of member_ids this will return a list of loaded members. | |
Returns the store carrying this collection | |
Tranforms and returns the collection into a bridge.Element instance | |
Generates an atom feed from the list of ``members`` provided, or if not provided, from the store directly up to the ``limit`` provided. | |
| Inherited from object | |
x.__delattr__('name') <==> del x.name | |
x.__getattribute__('name') <==> x.name | |
x.__hash__() <==> hash(x) | |
T.__new__(S, ...) -> a new object with type S, a subtype of T | |
helper for pickle | |
helper for pickle | |
x.__repr__() <==> repr(x) | |
x.__setattr__('name', value) <==> x.name = value | |
x.__str__() <==> str(x) | |
| Property Summary | |
|---|---|
collection: Tranforms and returns the collection into a bridge.Element
instance | |
feed: Generates an atom feed from the list of ``members`` provided, or if
not provided, from the store directly up to the ``limit`` provided. | |
store: Returns the store carrying this collection | |
| Method Details |
|---|
__init__(self,
workspace,
name_or_id,
title,
base_uri,
base_edit_uri,
base_media_edit_uri=None,
xml_attrs=None,
member_extension=u'atom',
member_media_type=u'application/atom+xml;type=entry',
accept_media_types=None,
categories=None,
fixed_categories=None,
favorite=False,
editable_media_types=None)
|
add_indexer(self, indexer)Add an initialized amplee.indexer.Indexer instance to the collection |
attach(self, member, member_content, member_id=None, member_info=None, media_id=None, media_info=None, media_content=None, check_media_type=True)Add a member to this collection by * adding it to the store * adding it to the internal cache if it is enabled You are not forced to pass the resource content through this method if you prefer storing it in a different location without using amplee. This method will throw a amplee.error.FixedCategoriesError is self.fixed_categories is True and none of the member categories matches self.categories. This method will throw a amplee.error.UnsupportedMediaType exception if check_media_type is True and the media type of the media resource does not fall into the allowed list. Keyword arguments: member -- amplee.atompub.member.* instance member_content -- Content to be persisted into the storage. Usually an XML string of the Atom entry member_id -- Internal id used to reference this member. Usually equals to the resource_name + collection.member_extension member_info -- Info under this member is stored media_id -- Internal id used to reference the resource associated to this member. media_info -- Info under the media resource is stored media_content -- Resource content check_media_type -- If False the resource media type will not be checked against collection.accept_media_types |
contains(self, info, as_media=False)Does a info belong to the store keyword arguments: info -- a info object as returned by get_meta_data_info or get_content_info as_media -- True when the info is to be tested on the media storage |
convert_id(self, id)Take the parameter and returns a tuple such as (member_id, media_id). Keyword arguments: id -- Can be either member_id or media_id |
dispatch(self, operation, media_type, *args, **kwargs)Dispatches the operation based for that media-type to the matching handler Keyword arguments: operation -- name of the callback handler media_type -- media-type string The *args and **kwargs dicts will be passed to the callback. Returns the result of the callback. |
enable_cache(self)Enable the internal cache |
get_base_edit_uri(self)Returns the absolute URI to the collection for editing operations |
get_base_media_edit_uri(self)Returns the absolute URI to the collection for media-editing operations |
get_base_uri(self)Returns the absolute URI to the collection public face |
get_content(self, info)Returns the content of the media resource or None. Does not check the existence of the resource. |
get_content_info(self, id)Constructs and returns the info to the resource pointed by the id parameter. |
get_handler(self, media_type)Returns a tuple (handler, memember_type) based on the provided media_type Raises a KeyError if it cannot be found Keyword argument: media_type -- media-type string |
get_member(self, member_id)Returns the requested member or None if not found. If the member is not in the collection cache, amplee attempts to load it from the storage. Keyword argument: member_id -- identifier of the member as returned by convert_id() |
get_meta_data(self, info)Returns an object stored as meta-data information in the store for a resource. Does not check the existence of the resource. |
get_meta_data_info(self, id)Constructs and returns the info to the member pointed by the id parameter. |
get_xml_base(self)Returns the first available xml:base value from either the collection, its workspace or service. If none is found it returns an empty string |
load_member(self, member_id, member_info=None)Loads a member from its storage and returns it or None if not found. The member is not added to the collection cache at this stage. Note that if the MLE has been deleted but not the media resource this method will still return None as if both didn't exist anymore. It's up to the application to cleanup the storages from time to time. Keyword argument: member_id -- identifier of the member as returned by convert_id() member_info -- info as returned by get_meta_data_info(), if not provided it will be computed automatically |
prune(self, member_id=None, media_id=None)Removes a member from a collection and the underlying stor. Removes only objects passed in the id parameters. Keyword arguments: member_id -- Identifier of the member media_id -- Identifier of the media resource |
register_handler(self, handler)Registers the provided handler to be available to this collection. Keyword arguments: handler -- class instance which must have an attribute 'member_type' which is an instance of the amplee.handler.MemberType class A handler is the instance of a class that may have the following callable attributes: on_error(exception, member) -> None on_create(member, content) -> member, content on_created(member) -> None on_update(existing_member, new_member, new_content) -> new_member, new_content on_updated(new_member) -> None on_delete(member) -> None on_deleted(member) -> None on_get_content(member, content, content_type) -> member, content, content_type on_get_atom(member) -> member, content, content_type on_update_feed(member) -> None If present those callbacks will be automatically applied. Not being present doesn't constitute a fault. |
reload_members(self, limit=0)Reloads all or part of existing members. Call this at server startup to refresh the collection. Careful as this could be a fairly long process. Returns the list of loaded members. Keyword argument limit -- indicate how many members you want to load By default 0 means all of them. |
reload_members_from_feed(self, source)Reloads members from a an atom feed. This can be useful if you want to keep in the collection cache some given entries. You can construct a feed of those member entries and provide it to this method. Returns the list of loaded members. Keyword argument: source -- can be a string, a path or a file object representing the feed |
reload_members_from_list(self, member_ids)Given a list of member_ids this will return a list of loaded members. |
store_container(self)Returns the store carrying this collection |
to_collection(self, prefix=u'app', namespace=u'http://www.w3.org/2007/app')Tranforms and returns the collection into a bridge.Element instance |
to_feed(self, members=None, prefix=u'atom', namespace=u'http://www.w3.org/2005/Atom', limit=-1, mint=None)Generates an atom feed from the list of ``members`` provided, or if not provided, from the store directly up to the ``limit`` provided. The atom:id element's value will be computed from the collection edit URI, and if provided, the ``mint`` value, which therefore must be string or None. Returns a bridge.Element instance of the feed. |
| Property Details |
|---|
collectionTranforms and returns the collection into a bridge.Element instance
|
feedGenerates an atom feed from the list of ``members`` provided, or if not provided, from the store directly up to the ``limit`` provided. The atom:id element's value will be computed from the collection edit URI, and if provided, the ``mint`` value, which therefore must be string or None. Returns a bridge.Element instance of the feed.
|
storeReturns the store carrying this collection
|
| Home | Trees | Index | Help |
|
|---|
| Generated by Epydoc 2.1 on Thu Jul 19 15:32:16 2007 | http://epydoc.sf.net |