Package amplee :: Package atompub :: Module store :: Class AtomPubStore
[hide private]
[frames] | no frames]

Class AtomPubStore

source code

object --+
         |
        AtomPubStore

Instance Methods [hide private]
 
__init__(self, storage, media_storage=None, enable_lock=False)
Store acting has a container of AtomPub entities.
source code
 
commit(self, message=None)
Persists modification to the store into the storages.
source code
 
get_meta_data_info(self, *args)
Returns the info of resource used by the meta-data storage.
source code
 
get_content_info(self, *args)
Returns the info of resource used by the content storage.
source code
 
add_content(self, info, obj, **kwargs)
Adds content to the content storage.
source code
 
add_meta_data(self, info, obj, **kwargs)
Adds meta-data to the meta-data storage.
source code
 
remove_meta_data(self, info)
Removes the resource at info from the meta-data storage.
source code
 
remove_content(self, info)
Removes the resource at info from the content storage.
source code
bool
exists(self, info, as_media=False)
Returns True if the resource info does exist.
source code
object
fetch_content(self, info)
Returns the content object at info.
source code
object
fetch_meta_data(self, info)
Returns the meta-data object at info.
source code
dict
list_members(self, info, ext=None)
Returns a dictionary of the form {resource-name: StorageResourceInfo} filtered by the given parameters.
source code
tuple
iter_members(self, info, ext=None)
Yield a tuple of the form (resource-name, StorageResourceInfo) filtered by the given parameters.
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, storage, media_storage=None, enable_lock=False)
(Constructor)

source code 

Store acting has a container of AtomPub entities.

Operations on the store are only commited to the storage automatically when the autocommit parameter is True. This is however not advised for performance issue.

In any case operations put each resource in distinct internal lists which are processed when commit() is called.
Parameters:
  • storage (Storage) - instance to persist member resources.
  • media_storage (Storage) - instance to persist media resources. If not provided storage will be used.
  • enable_lock (bool) - when True, a thread lock will be used when performing operations against the store. This is enabled by default.
Overrides: object.__init__

commit(self, message=None)

source code 
Persists modification to the store into the storages.
Parameters:
  • message (string) - if the storage accepts it (like subversion), message to pass to the storage.

get_meta_data_info(self, *args)

source code 

Returns the info of resource used by the meta-data storage. The returned value should only be seen as read-only.

Arguments depend on the underlying storage.

get_content_info(self, *args)

source code 

Returns the info of resource used by the content storage. The returned value should only be seen as read-only.

Arguments depend on the underlying storage.

add_content(self, info, obj, **kwargs)

source code 
Adds content to the content storage. If self.autocommit is True the content is immediatly persisted.
Parameters:
  • info (StorageResourceInfo or subclass) - value returned vy get_content_info()
  • obj (object) - whatever Python object that should be persisted
  • **kwargs (dict) - any additional parameters to provide to the storage

add_meta_data(self, info, obj, **kwargs)

source code 
Adds meta-data to the meta-data storage. If self.autocommit is True the content is immediatly persisted.
Parameters:
  • info (StorageResourceInfo or subclass) - value returned by get_meta_data_info()
  • obj (object) - whatever Python object that should be persisted
  • **kwargs (dict) - any additional parameters to provide to the storage

remove_meta_data(self, info)

source code 
Removes the resource at info from the meta-data storage. If self.autocommit is True the meta-data object is immediatly persisted.
Parameters:

remove_content(self, info)

source code 
Removes the resource at info from the content storage. If self.autocommit is True the content object is immediatly persisted.
Parameters:

exists(self, info, as_media=False)

source code 
Returns True if the resource info does exist.
Parameters:
  • info (StorageResourceInfo or subclass) - value returned by get_meta_data_info() or get_content_info()
  • as_media (bool) - if False the method checks in the member storage otherwise it checks in the media storage. When both are the same it does not matter but if both are different you should set this value accordingly.
Returns: bool
True if the resource exists in the storage queried

fetch_content(self, info)

source code 
Returns the content object at info.
Parameters:
Returns: object
the object as returned by the underlying storage and representing the content.

fetch_meta_data(self, info)

source code 
Returns the meta-data object at info.
Parameters:
Returns: object
the object as returned by the underlying storage and representing the content.

list_members(self, info, ext=None)

source code 
Returns a dictionary of the form {resource-name: StorageResourceInfo} filtered by the given parameters.
Parameters:
  • info (string) - name of the collection to browse through
  • ext (string or NoneType) - allows to filter by extension of the resource
Returns: dict
the resources matching the filter and the info

iter_members(self, info, ext=None)

source code 
Yield a tuple of the form (resource-name, StorageResourceInfo) filtered by the given parameters.
Parameters:
  • info (string) - name of the collection to browse through
  • ext (string or NoneType) - allows to filter by extension of the resource
Returns: tuple
the resources matching the filter and the info