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, autocommit=False, enable_lock=False)
Store acting has a container of APP entities.
  commit(self, message=None)
...
  get_meta_data_path(self, *args)
Returns the path of resource used by the meta-data storage.
  get_content_path(self, *args)
Returns the path of resource used by the content storage.
  add_content(self, path, obj, **kwargs)
Add contents to the content storage.
  add_meta_data(self, path, obj, **kwargs)
Add meta-data to the meta-data storage.
  remove_meta_data(self, path)
Remove the resource at 'path' from the meta-data storage.
  remove_content(self, path)
Remove the resource at 'path' from the content storage.
  exists(self, path)
Returns True if the resource 'path' does exist.
  fetch_content(self, path)
Returns the content object at 'path'.
  fetch_meta_data(self, path)
Returns the meta-data object at 'path'.
  list_members(self, path, ext=None)
Returns a dictionary of the form {resource-name: {'path': resource-path}} filtered by the given parameters.

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, autocommit=False, enable_lock=False)
(Constructor)

source code 

Store acting has a container of APP 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.

Keyword arguments:
storage -- amplee.storage.* instance to persist member resources
media_storage -- amplee.storage.* instance to persist media resources
If not provided 'storage' will be used. (default=None)
autocommit -- True if the store should automatically call the
persist method of the storage (default=False)
enable_lock -- True if a thread lock should be used when performing
operations against the store (default=False)

Overrides: object.__init__

commit(self, message=None)

source code 

Persist modification to the store into the storages

Keyword arguments:
message -- if the storage accept a string message,
like the subversion one (default=None)

get_meta_data_path(self, *args)

source code 

Returns the path 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_path(self, *args)

source code 

Returns the path 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, path, obj, **kwargs)

source code 

Add contents to the content storage.
If self.autocommit is True, the content is immediatly persisted.

Keyword arguments:
path -- value returned by get_content_path()
obj -- whatever Python object that should be persisted
**kwargs -- any additional parameters to provide to the storage

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

source code 

Add meta-data to the meta-data storage.
If self.autocommit is True, the meta-date object is immediatly persisted.

Keyword arguments:
path -- value returned by get_meta_data_path()
obj -- whatever Python object that should be persisted
**kwargs -- any additional parameters to provide to the storage

remove_meta_data(self, path)

source code 

Remove the resource at 'path' from the meta-data storage.
If self.autocommit is True, the meta-date object is immediatly persisted.

Keyword arguments:
path -- value returned by get_meta_data_path()

remove_content(self, path)

source code 

Remove the resource at 'path' from the content storage.
If self.autocommit is True, the meta-date object is immediatly persisted.

Keyword arguments:
path -- value returned by get_meta_data_path()

exists(self, path)

source code 

Returns True if the resource 'path' does exist.

Keyword arguments:
path -- value returned by get_meta_data_path() or get_content_path()

fetch_content(self, path)

source code 

Returns the content object at 'path'.

Keyword arguments:
path -- value returned by get_content_path()

fetch_meta_data(self, path)

source code 

Returns the meta-data object at 'path'.

Keyword arguments:
path -- value returned by get_meta_data_path()

list_members(self, path, ext=None)

source code 

Returns a dictionary of the form {resource-name: {'path': resource-path}} filtered
by the given parameters.

Keyword arguments:
path -- Base path where to perform the lookup
ext -- filter by extension of the resource (default=None)