Trees | Index | Help |
---|
Package WebStack :: Package Repositories :: Module Directory :: Class DirectoryRepository |
|
A directory repository providing session-like access to files.
Method Summary | |
---|---|
Initialise the repository using the given 'path' to indicate the location of the repository. | |
Remove the file associated with the given 'key'. | |
Return the contents of the file associated with the given 'key'. | |
Set the contents of the file associated with the given 'key' using the given 'value'. | |
Return the full path to the 'key' in the filesystem provided that the file associated with the 'key' is locked for editing. | |
Return the full path to the 'key' in the filesystem. | |
Return whether a file with the name specified by 'key is stored in the repository. | |
Return a list of (name, value) tuples for the files stored in the repository. | |
Return the names of the files stored in the repository. | |
Lock the file associated with the given 'key'. | |
Unlock the file associated with the given 'key'. | |
Return the contents of the files stored in the repository. |
Class Variable Summary | |
---|---|
str |
new_filename = '__new__'
|
Method Details |
---|
__init__(self,
path,
fsencoding=None,
delay=1)
|
__delitem__(self,
key)
|
__getitem__(self,
key)
|
__setitem__(self,
key,
value)
|
edit_path(self, key)Return the full path to the 'key' in the filesystem provided that the file associated with the 'key' is locked for editing. |
full_path(self, key, edit=0)Return the full path to the 'key' in the filesystem. If the optional 'edit' parameter is set to a true value, the returned path will refer to the editable version of the file. |
has_key(self, key)Return whether a file with the name specified by 'key is stored in the repository. |
items(self)Return a list of (name, value) tuples for the files stored in the repository. |
keys(self)Return the names of the files stored in the repository. |
lock(self, key, create=0, opener=None)Lock the file associated with the given 'key'. If the optional 'create' parameter is set to a true value (unlike the default), the file will be created if it did not already exist; otherwise, a KeyError will be raised. If the optional 'opener' parameter is specified, it will be used to create any new file in the case where 'create' is set to a true value; otherwise, the standard 'open' function will be used to create the file. Return the full path to the editable file. |
unlock(self, key)Unlock the file associated with the given 'key'. Important note: this method should be used in a finally clause in order to avoid files being locked and never being unlocked by the same process because an unhandled exception was raised. |
values(self)Return the contents of the files stored in the repository. |
Class Variable Details |
---|
new_filename
|
Trees | Index | Help |
---|
Generated by Epydoc 2.1 on Thu Mar 1 00:37:14 2007 | http://epydoc.sf.net |