From c1e460cc15523a0138dde1ece9d584554d99c04b Mon Sep 17 00:00:00 2001 From: drebs Date: Sun, 20 Jan 2013 11:56:37 -0200 Subject: Fix SQLCipher implementation registering. --- src/leap/soledad/backends/sqlcipher.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/leap/soledad/backends/sqlcipher.py b/src/leap/soledad/backends/sqlcipher.py index 6711aa86..f7dc6c0b 100644 --- a/src/leap/soledad/backends/sqlcipher.py +++ b/src/leap/soledad/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) + -- cgit v1.2.3