diff options
author | drebs <drebs@leap.se> | 2013-01-20 11:56:37 -0200 |
---|---|---|
committer | drebs <drebs@leap.se> | 2013-01-20 11:56:37 -0200 |
commit | a2a0800f0edc952f378fc09baf4022393a3fe2a0 (patch) | |
tree | 512bb55348eeadc745704b10a348a7dd7bd5041a /backends | |
parent | eafb7cd673e1d39ece0106a1ff811ac632dc0e25 (diff) |
Fix SQLCipher implementation registering.
Diffstat (limited to 'backends')
-rw-r--r-- | backends/sqlcipher.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/backends/sqlcipher.py b/backends/sqlcipher.py index 6711aa86..f7dc6c0b 100644 --- a/backends/sqlcipher.py +++ b/backends/sqlcipher.py @@ -61,6 +61,7 @@ class SQLCipherDatabase(SQLitePartialExpandDatabase): def set_pragma_key(cls, db_handle, key): db_handle.cursor().execute("PRAGMA key = '%s'" % key) + def __init__(self, sqlite_file, password, document_factory=None): """Create a new sqlcipher file.""" self._check_if_db_is_encrypted(sqlite_file) @@ -70,6 +71,7 @@ class SQLCipherDatabase(SQLitePartialExpandDatabase): self._ensure_schema() self._factory = document_factory or Document + def _check_if_db_is_encrypted(self, sqlite_file): if not os.path.exists(sqlite_file): return @@ -108,6 +110,7 @@ class SQLCipherDatabase(SQLitePartialExpandDatabase): return SQLCipherDatabase._sqlite_registry[v]( sqlite_file, password, document_factory=document_factory) + @classmethod def open_database(cls, sqlite_file, password, create, backend_cls=None, document_factory=None): @@ -123,6 +126,7 @@ class SQLCipherDatabase(SQLitePartialExpandDatabase): return backend_cls(sqlite_file, password, document_factory=document_factory) + @staticmethod def register_implementation(klass): """Register that we implement an SQLCipherDatabase. @@ -132,4 +136,5 @@ class SQLCipherDatabase(SQLitePartialExpandDatabase): SQLCipherDatabase._sqlite_registry[klass._index_storage_value] = klass -SQLCipherDatabase.register_implementation(SQLCipherDatabase)
\ No newline at end of file +SQLiteDatabase.register_implementation(SQLCipherDatabase) + |