libbe.storage.http

Define an HTTP-based VersionedStorage implementation.

See Also

libbe.command.serve_storage : the associated server

class libbe.storage.http.HTTP(repo, *args, **kwargs)

VersionedStorage implementation over HTTP.

Uses GET to retrieve information and POST to set information.

Methods

add(id, *args, **kwargs) Add an entry
ancestors(*args, **kwargs) Return a list of the specified entry’s ancestors’ ids.
changed([revision])
check_storage_version()
children(*args, **kwargs) Return a list of specified entry’s children’s ids.
commit(*args, **kwargs) Commit the current repository, with a commit message string summary and body.
connect() Open a connection to the repository.
destroy() Remove the storage repository.
disconnect() Close the connection to the repository.
exists(*args, **kwargs) Check an entry’s existence
get(*args, **kwargs) Get contents of and entry as they were in a given revision.
get_post_url(url[, get, data_dict, headers])
init() Create a new storage repository.
is_readable()
is_writeable()
parse_repo(repo) Grab username and password (if any) from the repo URL.
recursive_remove(*args, **kwargs) Remove an entry and all its decendents.
remove(*args, **kwargs) Remove an entry.
revision_id([index]) Return the name of the <index>th revision.
set(id, value, *args, **kwargs) Set the entry contents.
storage_version([revision])
version() Return a version string for this backend.
changed(revision=None)
check_storage_version()
get_post_url(url, get=True, data_dict=None, headers=[])
name = 'HTTP'
parse_repo(repo)

Grab username and password (if any) from the repo URL.

Examples

>>> s = HTTP('http://host.com/path/to/repo')
>>> s.repo
'http://host.com/path/to/repo'
>>> s.uname == None
True
>>> s.password == None
True
>>> s.parse_repo('http://joe:secret@host.com/path/to/repo')
('http://host.com/path/to/repo', 'joe', 'secret')
revision_id(index=None)

Return the name of the <index>th revision.

The choice of which branch to follow when crossing branches/merges is not defined. Revision indices start at 1; ID 0 is the blank repository.

Return None if index==None.

Raises :

InvalidRevision :

If the specified revision does not exist.

storage_version(revision=None)
user_agent = 'BE-HTTP-Storage'

Table Of Contents

This Page