shelvedb submodule¶
Module used to load/store object from/to shelve database.
-
aleph_link_export.shelvedb.
shelver
(*args, **kwds)¶ In python 2.7, there is no context manager for shelve. So this is it.
-
class
aleph_link_export.shelvedb.
ShelveDatabase
(log_fn, db_fn, db_key, logging)¶ Bases:
object
Class that can save and load itself to shelve.
-
db_fn
= None¶ Path to the database file.
-
log_fn
= None¶ Path to the log file.
-
logging
= None¶ Is the logging enabled?
-
save
()¶ Save this object to shelve.
-
static
load
(fn, db_key, creator)¶ Load the database from the shelve fn.
Parameters: - fn (str) – Path to the database file.
- db_key (str) – What database key to use. Default
DATABASE_KEY
. - creator (reference) – Reference to the function, which will
create new
RequestDatabase
if the old is not found. Default lambda, which expects fn parameterlambda fn: ..
.
Returns: RequestDatabase
instance from the fn or newlycreated.
Return type: obj
-