From: Mark Wooding Date: Sun, 24 May 2015 18:22:29 +0000 (+0100) Subject: catacomb/pwsafe.py, pwsafe: Dispatching for multiple backends. X-Git-Tag: 1.1.0~9 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/catacomb-python/commitdiff_plain/6baae40547e9218221e7ce5901e28991cedeb60c?ds=inline;hp=6baae40547e9218221e7ce5901e28991cedeb60c 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. ---