From 3e0d12b8130a317c11da5145bb878b70b3bd8cac Mon Sep 17 00:00:00 2001 From: drebs Date: Tue, 9 Apr 2013 13:56:22 -0300 Subject: Add check for presence of a shared db. --- src/leap/soledad/__init__.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/leap/soledad/__init__.py b/src/leap/soledad/__init__.py index baf303e3..b636b744 100644 --- a/src/leap/soledad/__init__.py +++ b/src/leap/soledad/__init__.py @@ -178,6 +178,8 @@ class Soledad(object): self.shared_db_url, True, token=auth_token) + else: + self._shared_db = None def _init_config(self, **kwargs): """ @@ -472,8 +474,8 @@ class Soledad(object): @rtype: LeapDocument """ # TODO: change below to raise appropriate exceptions - #if not hasattr(self, '_shared_db'): - # return None + if not self._shared_db: + return None return self._shared_db.get_doc_unauth(self._user_hash()) def _assert_server_keys(self): @@ -481,8 +483,8 @@ class Soledad(object): Assert our key copies are the same as server's ones. """ assert self._has_keys() - #if not hasattr(self, '_shared_db'): - # return + if not self._shared_db: + return doc = self._get_keys_doc() if doc: remote_privkey = self.decrypt(doc.content['_privkey'], -- cgit v1.2.3