Python 2 (all versions) want you to set `__metaclass__' within the class
body. Python 3 ignores this, treating it like an ordinary class
attribute, and wants you to say `metaclass = ...' in the direct-
superclass list; but the latter is a syntax error to Python 2.
Instead, add a hack which constructs a anonymous class with the right
metaclass to use as a direct superclass. It's awful, but it works.
_CIPHER = _bin('cipher:')
_MAC = _bin('mac:')
_CIPHER = _bin('cipher:')
_MAC = _bin('mac:')
+def _with_metaclass(meta, *supers):
+ return meta("#<anonymous base %s>" % meta.__name__,
+ supers or (object,), dict())
+
def _excval(): return SYS.exc_info()[1]
_M600 = int("600", 8)
def _excval(): return SYS.exc_info()[1]
_M600 = int("600", 8)
except AttributeError: pass
else: StorageBackend.register_concrete_subclass(me)
except AttributeError: pass
else: StorageBackend.register_concrete_subclass(me)
-class StorageBackend (object):
+class StorageBackend (_with_metaclass(StorageBackendClass)):
"""
I provide basic protocol for password storage backends.
"""
I provide basic protocol for password storage backends.
priority order when opening an existing database.
"""
priority order when opening an existing database.
"""
- __metaclass__ = StorageBackendClass
PRIO = 10
## The registry of subclasses.
PRIO = 10
## The registry of subclasses.