summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authordrebs <drebs@leap.se>2017-02-25 09:11:44 -0300
committerdrebs <drebs@leap.se>2017-02-25 09:11:57 -0300
commit425bfe42ca3758cfa4cda4589ebb42530313850b (patch)
treefcc997975d04333debf81f086ec1be2f57720219 /client
parentb433c1ed736f5d4c19da4cdb21108a02459ca7fd (diff)
[doc] improve doc and rename EmitMixin to UserDataMixin
Diffstat (limited to 'client')
-rw-r--r--client/src/leap/soledad/client/_secrets/__init__.py4
-rw-r--r--client/src/leap/soledad/client/_secrets/storage.py4
-rw-r--r--client/src/leap/soledad/client/_secrets/util.py10
3 files changed, 13 insertions, 5 deletions
diff --git a/client/src/leap/soledad/client/_secrets/__init__.py b/client/src/leap/soledad/client/_secrets/__init__.py
index 43541e16..79b6844a 100644
--- a/client/src/leap/soledad/client/_secrets/__init__.py
+++ b/client/src/leap/soledad/client/_secrets/__init__.py
@@ -24,7 +24,7 @@ from leap.soledad.common.log import getLogger
from leap.soledad.client._secrets.storage import SecretsStorage
from leap.soledad.client._secrets.crypto import SecretsCrypto
-from leap.soledad.client._secrets.util import emit, EmitMixin
+from leap.soledad.client._secrets.util import emit, UserDataMixin
logger = getLogger(__name__)
@@ -33,7 +33,7 @@ logger = getLogger(__name__)
SecretLength = namedtuple('SecretLength', 'name length')
-class Secrets(EmitMixin):
+class Secrets(UserDataMixin):
# remote secret is used
diff --git a/client/src/leap/soledad/client/_secrets/storage.py b/client/src/leap/soledad/client/_secrets/storage.py
index bb74dba3..89b44266 100644
--- a/client/src/leap/soledad/client/_secrets/storage.py
+++ b/client/src/leap/soledad/client/_secrets/storage.py
@@ -25,13 +25,13 @@ from leap.soledad.common.log import getLogger
from leap.soledad.common.document import SoledadDocument
from leap.soledad.client.shared_db import SoledadSharedDatabase
-from leap.soledad.client._secrets.util import emit, EmitMixin
+from leap.soledad.client._secrets.util import emit, UserDataMixin
logger = getLogger(__name__)
-class SecretsStorage(EmitMixin):
+class SecretsStorage(UserDataMixin):
def __init__(self, soledad):
self._soledad = soledad
diff --git a/client/src/leap/soledad/client/_secrets/util.py b/client/src/leap/soledad/client/_secrets/util.py
index 75418518..6401889b 100644
--- a/client/src/leap/soledad/client/_secrets/util.py
+++ b/client/src/leap/soledad/client/_secrets/util.py
@@ -23,12 +23,20 @@ class SecretsError(Exception):
pass
-class EmitMixin(object):
+class UserDataMixin(object):
+ """
+ When emitting an event, we have to pass a dictionary containing user data.
+ This class only defines a property so we don't have to define it in
+ multiple places.
+ """
@property
def _user_data(self):
uuid = self._soledad.uuid
userid = self._soledad.userid
+ # TODO: seems that uuid and userid hold the same value! We should check
+ # whether we should pass something different or if the events api
+ # really needs two different values.
return {'uuid': uuid, 'userid': userid}