summaryrefslogtreecommitdiff
path: root/src/leap/soledad
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@leap.se>2013-05-18 17:39:11 -0300
committerTomás Touceda <chiiph@leap.se>2013-05-18 17:39:11 -0300
commitf4ef0ac87021bc4d284f6ab2cc226de6926c5f78 (patch)
tree5f3ad3ed9c64aa611c22cd72040bc5c660655a75 /src/leap/soledad
parent8db98c3871fb7632cb0c29b219d7a1abed32f280 (diff)
parent24dbc5f63c33b11febb730b1a72e28983a31dc9a (diff)
Merge remote-tracking branch 'kali/feature/blank-server' into develop
Diffstat (limited to 'src/leap/soledad')
-rw-r--r--src/leap/soledad/__init__.py21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/leap/soledad/__init__.py b/src/leap/soledad/__init__.py
index 8bdb82a0..b051a80c 100644
--- a/src/leap/soledad/__init__.py
+++ b/src/leap/soledad/__init__.py
@@ -527,10 +527,11 @@ class Soledad(object):
"""
Return an instance of the shared recovery database object.
"""
- return SoledadSharedDatabase.open_database(
- urlparse.urljoin(self.server_url, 'shared'),
- False, # TODO: eliminate need to create db here.
- creds=self._creds)
+ if self.server_url:
+ return SoledadSharedDatabase.open_database(
+ urlparse.urljoin(self.server_url, 'shared'),
+ False, # TODO: eliminate need to create db here.
+ creds=self._creds)
def _get_secrets_from_shared_db(self):
"""
@@ -542,7 +543,11 @@ class Soledad(object):
"""
events.signal(
events.events_pb2.SOLEDAD_DOWNLOADING_KEYS, self._uuid)
- doc = self._shared_db().get_doc(self._uuid_hash())
+ db = self._shared_db()
+ if not db:
+ logger.warning('No shared db found')
+ return
+ doc = db.get_doc(self._uuid_hash())
events.signal(
events.events_pb2.SOLEDAD_DONE_DOWNLOADING_KEYS, self._uuid)
return doc
@@ -572,7 +577,11 @@ class Soledad(object):
# upload secrets to server
events.signal(
events.events_pb2.SOLEDAD_UPLOADING_KEYS, self._uuid)
- self._shared_db().put_doc(doc)
+ db = self._shared_db()
+ if not db:
+ logger.warning('No shared db found')
+ return
+ db.put_doc(doc)
events.signal(
events.events_pb2.SOLEDAD_DONE_UPLOADING_KEYS, self._uuid)