chiark / gitweb /
catacomb/pwsafe.py, pwsafe: Dispatching for multiple backends.
authorMark Wooding <mdw@distorted.org.uk>
Sun, 24 May 2015 18:22:29 +0000 (19:22 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 31 May 2015 21:42:53 +0000 (22:42 +0100)
commit6baae40547e9218221e7ce5901e28991cedeb60c
tree06c4011c716006ca115f3689626cd1278479063e
parent1726ab403eaf0c44e1a1a4643b256e1e214b792d
catacomb/pwsafe.py, pwsafe: Dispatching for multiple backends.

This commit introduces a number of tightly related changes.

  * Have concrete backends declare a `NAME' attribute.  This lets users
    name them, and lets us determine which classes are concrete.

  * Introduce a metaclass which registers concrete StorageClass
    subclasses.

  * Extend the `_open' protocol, so that it can raise the new
    StorageBackendRefusal exception to indicate that some other backend
    should try to open the given file.

  * Introduce a `StorageBackend.open' method which examines all
    registered backends and gives each of them an opportunity to open
    the file in some priority order.

  * Add a new method for looking up backends by name.

  * introduce a new DBCLS parameter to `PW.create', which is the backend
    class to use when creating a new database.

  * Introduce a new option to the `create' command to choose the
    database backend by name.

There's only one backend at the moment, though that will change soon.
catacomb/pwsafe.py
pwsafe