summaryrefslogtreecommitdiff
path: root/src/leap/soledad/backends
diff options
context:
space:
mode:
authordrebs <drebs@leap.se>2013-04-09 10:09:38 -0300
committerdrebs <drebs@leap.se>2013-04-09 10:09:38 -0300
commita8adbad77d34c66eda2a79e19b9afbc0f3d471a6 (patch)
tree5082c213fb1bea9c12746c294f019623af6353d9 /src/leap/soledad/backends
parente6ca75a9e2a7a634f92ae54238df7d86100fbdab (diff)
Eliminate the use of super() in main code.
Tests inherited from u1db still use super, but that can be changed in the future.
Diffstat (limited to 'src/leap/soledad/backends')
-rw-r--r--src/leap/soledad/backends/couch.py8
-rw-r--r--src/leap/soledad/backends/leap_backend.py4
-rw-r--r--src/leap/soledad/backends/objectstore.py12
-rw-r--r--src/leap/soledad/backends/sqlcipher.py7
4 files changed, 17 insertions, 14 deletions
diff --git a/src/leap/soledad/backends/couch.py b/src/leap/soledad/backends/couch.py
index 5407f992..1843bad1 100644
--- a/src/leap/soledad/backends/couch.py
+++ b/src/leap/soledad/backends/couch.py
@@ -110,10 +110,10 @@ class CouchDatabase(ObjectStoreDatabase):
except ResourceNotFound:
self._server.create(self._dbname)
self._database = self._server[self._dbname]
- super(CouchDatabase, self).__init__(replica_uid=replica_uid,
- # TODO: move the factory choice
- # away
- document_factory=LeapDocument)
+ ObjectStoreDatabase.__init__(self, replica_uid=replica_uid,
+ # TODO: move the factory choice
+ # away
+ document_factory=LeapDocument)
#-------------------------------------------------------------------------
# methods from Database
diff --git a/src/leap/soledad/backends/leap_backend.py b/src/leap/soledad/backends/leap_backend.py
index 3110c662..52a8463d 100644
--- a/src/leap/soledad/backends/leap_backend.py
+++ b/src/leap/soledad/backends/leap_backend.py
@@ -90,7 +90,7 @@ class LeapDocument(Document):
@param syncable: Should this document be synced with remote replicas?
@type syncable: bool
"""
- super(LeapDocument, self).__init__(doc_id, rev, json, has_conflicts)
+ Document.__init__(self, doc_id, rev, json, has_conflicts)
self._soledad = soledad
self._syncable = syncable
if encrypted_json:
@@ -209,7 +209,7 @@ class LeapSyncTarget(HTTPSyncTarget):
document contents when syncing.
@type soledad: soledad.Soledad
"""
- super(LeapSyncTarget, self).__init__(url, creds)
+ HTTPSyncTarget.__init__(self, url, creds)
self._soledad = soledad
def _parse_sync_stream(self, data, return_doc_cb, ensure_callback=None):
diff --git a/src/leap/soledad/backends/objectstore.py b/src/leap/soledad/backends/objectstore.py
index 38de421f..8afac3ec 100644
--- a/src/leap/soledad/backends/objectstore.py
+++ b/src/leap/soledad/backends/objectstore.py
@@ -66,7 +66,8 @@ class ObjectStoreDatabase(InMemoryDatabase):
parameters as Document.__init__.
@type document_factory: callable
"""
- super(ObjectStoreDatabase, self).__init__(
+ InMemoryDatabase.__init__(
+ self,
replica_uid,
document_factory=document_factory)
# sync data in memory with data in object store
@@ -85,7 +86,7 @@ class ObjectStoreDatabase(InMemoryDatabase):
@param replica_uid: The uid of the replica.
@type replica_uid: str
"""
- super(ObjectStoreDatabase, self)._set_replica_uid(replica_uid)
+ InMemoryDatabase._set_replica_uid(self, replica_uid)
self._store_u1db_data()
def _put_doc(self, doc):
@@ -185,7 +186,7 @@ class ObjectStoreDatabase(InMemoryDatabase):
@param index_name: The name of the index we are removing.
@type index_name: str
"""
- super(ObjectStoreDatabase, self).delete_index(index_name)
+ InMemoryDatabase.delete_index(self, index_name)
self._store_u1db_data()
def _replace_conflicts(self, doc, conflicts):
@@ -199,7 +200,7 @@ class ObjectStoreDatabase(InMemoryDatabase):
@param conflicts: The new set of conflicts.
@type conflicts: list
"""
- super(ObjectStoreDatabase, self)._replace_conflicts(doc, conflicts)
+ InMemoryDatabase._replace_conflicts(self, doc, conflicts)
self._store_u1db_data()
def _do_set_replica_gen_and_trans_id(self, other_replica_uid,
@@ -220,7 +221,8 @@ class ObjectStoreDatabase(InMemoryDatabase):
generation.
@type other_transaction_id: str
"""
- super(ObjectStoreDatabase, self)._do_set_replica_gen_and_trans_id(
+ InMemoryDatabase._do_set_replica_gen_and_trans_id(
+ self,
other_replica_uid,
other_generation,
other_transaction_id)
diff --git a/src/leap/soledad/backends/sqlcipher.py b/src/leap/soledad/backends/sqlcipher.py
index 9e3c38c9..a4d53fa8 100644
--- a/src/leap/soledad/backends/sqlcipher.py
+++ b/src/leap/soledad/backends/sqlcipher.py
@@ -256,7 +256,8 @@ class SQLCipherDatabase(sqlite_backend.SQLitePartialExpandDatabase):
@param doc: The new version of the document.
@type doc: u1db.Document
"""
- super(SQLCipherDatabase, self)._put_and_update_indexes(old_doc, doc)
+ sqlite_backend.SQLitePartialExpandDatabase._put_and_update_indexes(
+ self, old_doc, doc)
c = self._db_handle.cursor()
c.execute('UPDATE document SET syncable=? WHERE doc_id=?',
(doc.syncable, doc.doc_id))
@@ -275,8 +276,8 @@ class SQLCipherDatabase(sqlite_backend.SQLitePartialExpandDatabase):
@return: a Document object.
@type: u1db.Document
"""
- doc = super(SQLCipherDatabase, self)._get_doc(doc_id,
- check_for_conflicts)
+ doc = sqlite_backend.SQLitePartialExpandDatabase._get_doc(
+ self, doc_id, check_for_conflicts)
if doc:
c = self._db_handle.cursor()
c.execute('SELECT syncable FROM document WHERE doc_id=?',