diff options
author | drebs <drebs@leap.se> | 2013-01-24 12:03:45 -0200 |
---|---|---|
committer | drebs <drebs@leap.se> | 2013-01-24 12:03:45 -0200 |
commit | 71df5a4431bce607550eec4425f4fdfbdbfa2af7 (patch) | |
tree | f71347068d0a9296c857a5027728130e7ed14ca8 /backends/sqlcipher.py | |
parent | 3bf11c9109a457ddbeb47524e34a5c1fd97bd27c (diff) | |
parent | 2f761fea9e72554806b012c64d00fcae80e1d254 (diff) |
Merge branch 'feature/soledad-api' into develop
Conflicts:
src/leap/soledad/util.py
Diffstat (limited to 'backends/sqlcipher.py')
-rw-r--r-- | backends/sqlcipher.py | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/backends/sqlcipher.py b/backends/sqlcipher.py index 3d03449e..08b4df43 100644 --- a/backends/sqlcipher.py +++ b/backends/sqlcipher.py @@ -59,11 +59,9 @@ class SQLCipherDatabase(SQLitePartialExpandDatabase): _index_storage_value = 'expand referenced encrypted' - @classmethod def set_pragma_key(cls, db_handle, key): - db_handle.cursor().execute("PRAGMA key = '%s'" % key) - + db_handle.cursor().execute("PRAGMA key = '%s'" % key) def __init__(self, sqlite_file, password, document_factory=None): """Create a new sqlcipher file.""" @@ -74,20 +72,18 @@ 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 else: try: - # try to open an encrypted database with the regular u1db backend - # should raise a DatabaseError exception. + # try to open an encrypted database with the regular u1db + # backend should raise a DatabaseError exception. SQLitePartialExpandDatabase(sqlite_file) raise DatabaseIsNotEncrypted() except DatabaseError: pass - @classmethod def _open_database(cls, sqlite_file, password, document_factory=None): if not os.path.isfile(sqlite_file): @@ -113,7 +109,6 @@ 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): @@ -129,7 +124,6 @@ class SQLCipherDatabase(SQLitePartialExpandDatabase): return backend_cls(sqlite_file, password, document_factory=document_factory) - def sync(self, url, creds=None, autocreate=True, soledad=None): """ Synchronize encrypted documents with remote replica exposed at url. @@ -137,9 +131,7 @@ class SQLCipherDatabase(SQLitePartialExpandDatabase): from u1db.sync import Synchronizer from leap.soledad.backends.leap_backend import LeapSyncTarget return Synchronizer(self, LeapSyncTarget(url, creds=creds), - soledad=self._soledad).sync( - autocreate=autocreate) + soledad=self._soledad).sync(autocreate=autocreate) SQLiteDatabase.register_implementation(SQLCipherDatabase) - |