summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordrebs <drebs@leap.se>2014-04-29 13:29:23 -0300
committerdrebs <drebs@leap.se>2014-05-22 18:43:48 -0300
commit8e750af78bd8f9a37d1b095712b66e6ecdb3e102 (patch)
tree91a5691cbfdd81d93a7b2b2a2da4cf3d91699833
parent5cb40a959af827e4eadde1c047664c4f4c0ae01d (diff)
Cleanup and pep8 fix.
-rw-r--r--client/src/leap/soledad/client/__init__.py11
-rw-r--r--client/src/leap/soledad/client/shared_db.py4
-rw-r--r--common/src/leap/soledad/common/errors.py1
-rw-r--r--server/src/leap/soledad/server/lock_resource.py5
4 files changed, 10 insertions, 11 deletions
diff --git a/client/src/leap/soledad/client/__init__.py b/client/src/leap/soledad/client/__init__.py
index 46e3cd5f..8881b422 100644
--- a/client/src/leap/soledad/client/__init__.py
+++ b/client/src/leap/soledad/client/__init__.py
@@ -720,8 +720,9 @@ class Soledad(object):
:return: the hash
:rtype: str
"""
- return sha256('%s%s' %
- (self._passphrase_as_string(), self.uuid)).hexdigest()
+ return sha256(
+ '%s%s' %
+ (self._passphrase_as_string(), self.uuid)).hexdigest()
def _get_secrets_from_shared_db(self):
"""
@@ -1211,7 +1212,6 @@ class Soledad(object):
"""
soledad_assert(self.STORAGE_SECRETS_KEY in data)
# check mac of the recovery document
- #mac_auth = False # XXX ?
mac = None
if MAC_KEY in data:
soledad_assert(data[MAC_KEY] is not None)
@@ -1234,7 +1234,6 @@ class Soledad(object):
if mac != data[MAC_KEY]:
raise WrongMac('Could not authenticate recovery document\'s '
'contents.')
- #mac_auth = True # XXX ?
# include secrets in the secret pool.
secrets = 0
for secret_id, secret_data in data[self.STORAGE_SECRETS_KEY].items():
@@ -1296,9 +1295,9 @@ class Soledad(object):
return self._passphrase.encode('utf-8')
-#-----------------------------------------------------------------------------
+# ----------------------------------------------------------------------------
# Monkey patching u1db to be able to provide a custom SSL cert
-#-----------------------------------------------------------------------------
+# ----------------------------------------------------------------------------
# We need a more reasonable timeout (in seconds)
SOLEDAD_TIMEOUT = 120
diff --git a/client/src/leap/soledad/client/shared_db.py b/client/src/leap/soledad/client/shared_db.py
index 0753cbb5..52e51c6f 100644
--- a/client/src/leap/soledad/client/shared_db.py
+++ b/client/src/leap/soledad/client/shared_db.py
@@ -30,9 +30,9 @@ from leap.soledad.common import SHARED_DB_LOCK_DOC_ID_PREFIX
from leap.soledad.client.auth import TokenBasedAuth
-#-----------------------------------------------------------------------------
+# ----------------------------------------------------------------------------
# Soledad shared database
-#-----------------------------------------------------------------------------
+# ----------------------------------------------------------------------------
class NoTokenForAuth(Exception):
"""
diff --git a/common/src/leap/soledad/common/errors.py b/common/src/leap/soledad/common/errors.py
index 3a7eadd2..ea4bf7f6 100644
--- a/common/src/leap/soledad/common/errors.py
+++ b/common/src/leap/soledad/common/errors.py
@@ -62,6 +62,7 @@ class InvalidAuthTokenError(errors.Unauthorized):
wire_descrition = "invalid auth token"
status = 401
+
#
# LockResource errors
#
diff --git a/server/src/leap/soledad/server/lock_resource.py b/server/src/leap/soledad/server/lock_resource.py
index a7870f77..0a602e26 100644
--- a/server/src/leap/soledad/server/lock_resource.py
+++ b/server/src/leap/soledad/server/lock_resource.py
@@ -178,9 +178,8 @@ class LockResource(object):
error=InvalidTokenError.wire_description)
else:
self._shared_db.delete_doc(lock_doc)
- self._responder.send_response_json(200) # success: should use 204
- # but u1db does not
- # support it.
+ # respond success: should use 204 but u1db does not support it.
+ self._responder.send_response_json(200)
def _remaining(self, lock_doc, now):
"""