summaryrefslogtreecommitdiff
path: root/common/src
diff options
context:
space:
mode:
Diffstat (limited to 'common/src')
-rw-r--r--common/src/leap/soledad/common/backend.py5
-rw-r--r--common/src/leap/soledad/common/couch/__init__.py3
-rw-r--r--common/src/leap/soledad/common/tests/test_command.py5
3 files changed, 8 insertions, 5 deletions
diff --git a/common/src/leap/soledad/common/backend.py b/common/src/leap/soledad/common/backend.py
index 53426fb5..0a36c068 100644
--- a/common/src/leap/soledad/common/backend.py
+++ b/common/src/leap/soledad/common/backend.py
@@ -18,7 +18,7 @@
"""A U1DB generic backend."""
-
+import functools
from u1db import vectorclock
from u1db.errors import (
RevisionConflict,
@@ -438,9 +438,8 @@ class SoledadBackend(CommonBackend):
generation.
:type other_transaction_id: str
"""
- function = self._set_replica_gen_and_trans_id
args = [other_replica_uid, other_generation, other_transaction_id]
- callback = lambda: function(*args)
+ callback = functools.partial(self._set_replica_gen_and_trans_id, *args)
if self.batching:
self.after_batch_callbacks['set_source_info'] = callback
else:
diff --git a/common/src/leap/soledad/common/couch/__init__.py b/common/src/leap/soledad/common/couch/__init__.py
index 18ed8a19..5bda8071 100644
--- a/common/src/leap/soledad/common/couch/__init__.py
+++ b/common/src/leap/soledad/common/couch/__init__.py
@@ -24,6 +24,7 @@ import re
import uuid
import binascii
import time
+import functools
from StringIO import StringIO
@@ -340,7 +341,7 @@ class CouchDatabase(object):
# This will not be needed when/if we switch from python-couchdb to
# paisley.
time.strptime('Mar 8 1917', '%b %d %Y')
- get_one = lambda doc_id: self.get_doc(doc_id, check_for_conflicts)
+ get_one = functools.partial(self.get_doc, check_for_conflicts=check_for_conflicts)
docs = [THREAD_POOL.apply_async(get_one, [doc_id])
for doc_id in doc_ids]
for doc in docs:
diff --git a/common/src/leap/soledad/common/tests/test_command.py b/common/src/leap/soledad/common/tests/test_command.py
index c386bdd2..2136bb8f 100644
--- a/common/src/leap/soledad/common/tests/test_command.py
+++ b/common/src/leap/soledad/common/tests/test_command.py
@@ -21,10 +21,13 @@ from twisted.trial import unittest
from leap.soledad.common.command import exec_validated_cmd
+def validator(arg):
+ return True if arg is 'valid' else False
+
+
class ExecuteValidatedCommandTest(unittest.TestCase):
def test_argument_validation(self):
- validator = lambda arg: True if arg is 'valid' else False
status, out = exec_validated_cmd("command", "invalid arg", validator)
self.assertEquals(status, 1)
self.assertEquals(out, "invalid argument")