summaryrefslogtreecommitdiff
path: root/src/leap/soledad/backends/openstack.py
diff options
context:
space:
mode:
authordrebs <drebs@leap.se>2013-01-24 11:58:56 -0200
committerdrebs <drebs@leap.se>2013-01-24 11:58:56 -0200
commit1dec55b5c5054a4c42534c0f7e9b8bad5b82c27c (patch)
tree79cc82f9c1d12f92ac82a8e2bcd3eb1682d6db90 /src/leap/soledad/backends/openstack.py
parent6bd210fac7d5da5efeaa646a51f6c50b00e600a2 (diff)
Source files stick to pep8.
Diffstat (limited to 'src/leap/soledad/backends/openstack.py')
-rw-r--r--src/leap/soledad/backends/openstack.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/leap/soledad/backends/openstack.py b/src/leap/soledad/backends/openstack.py
index c027231c..a9615736 100644
--- a/src/leap/soledad/backends/openstack.py
+++ b/src/leap/soledad/backends/openstack.py
@@ -1,6 +1,6 @@
-from u1db import errors
+# TODO: this backend is not tested yet.
from u1db.remote.http_target import HTTPSyncTarget
-from swiftclient import client
+import swiftclient
from soledad.backends.objectstore import ObjectStore
@@ -25,12 +25,13 @@ class OpenStackDatabase(ObjectStore):
def _get_doc(self, doc_id, check_for_conflicts=False):
"""Get just the document content, without fancy handling.
-
+
Conflicts do not happen on server side, so there's no need to check
for them.
"""
try:
- response, contents = self._connection.get_object(self._container, doc_id)
+ response, contents = self._connection.get_object(self._container,
+ doc_id)
# TODO: change revision to be a dictionary element?
rev = response['x-object-meta-rev']
return self._factory(doc_id, rev, contents)
@@ -53,7 +54,7 @@ class OpenStackDatabase(ObjectStore):
def _put_doc(self, doc, new_rev):
new_rev = self._allocate_doc_rev(doc.rev)
# TODO: change revision to be a dictionary element?
- headers = { 'X-Object-Meta-Rev' : new_rev }
+ headers = {'X-Object-Meta-Rev': new_rev}
self._connection.put_object(self._container, doc_id, doc.get_json(),
headers=headers)
@@ -77,6 +78,7 @@ class OpenStackDatabase(ObjectStore):
self._url, self._auth_token = self._connection.get_auth()
return self._url, self.auth_token
+
class OpenStackSyncTarget(HTTPSyncTarget):
def get_sync_info(self, source_replica_uid):
@@ -94,5 +96,3 @@ class OpenStackSyncTarget(HTTPSyncTarget):
self._db._set_replica_gen_and_trans_id(
source_replica_uid, source_replica_generation,
source_replica_transaction_id)
-
-