summaryrefslogtreecommitdiff
path: root/service/pixelated
diff options
context:
space:
mode:
authorBruno Wagner <bwgpro@gmail.com>2015-04-23 12:02:32 -0300
committerBruno Wagner <bwgpro@gmail.com>2015-04-23 12:04:21 -0300
commitd7968a5feb8d556f40f77274da32921e83465d9e (patch)
tree6fc6a95a00b9a404f97f7944d2c3ab02e67145e9 /service/pixelated
parented9084b0b9175a272401b231e5d086e64506af15 (diff)
Patched soledad sync so it will give us meaningful error messages
Diffstat (limited to 'service/pixelated')
-rw-r--r--service/pixelated/config/__init__.py1
-rw-r--r--service/pixelated/support/ext_sync.py23
2 files changed, 24 insertions, 0 deletions
diff --git a/service/pixelated/config/__init__.py b/service/pixelated/config/__init__.py
index 67552f99..f59d684b 100644
--- a/service/pixelated/config/__init__.py
+++ b/service/pixelated/config/__init__.py
@@ -36,6 +36,7 @@ import pixelated.support.ext_protobuf
import pixelated.support.ext_sqlcipher
import pixelated.support.ext_esmtp_sender_factory
import pixelated.support.ext_fetch
+import pixelated.support.ext_sync
import pixelated.support.ext_keymanager_fetch_key
import pixelated.support.ext_requests_urllib3
from pixelated.support.error_handler import error_handler
diff --git a/service/pixelated/support/ext_sync.py b/service/pixelated/support/ext_sync.py
new file mode 100644
index 00000000..d35eed3e
--- /dev/null
+++ b/service/pixelated/support/ext_sync.py
@@ -0,0 +1,23 @@
+import leap.soledad.client as client
+import logging
+import urlparse
+from leap.soledad.client.events import (
+ SOLEDAD_DONE_DATA_SYNC,
+ signal
+)
+
+
+def patched_sync(self, defer_decryption=True):
+ if self._db:
+ try:
+ local_gen = self._db.sync(
+ urlparse.urljoin(self.server_url, 'user-%s' % self._uuid),
+ creds=self._creds, autocreate=False,
+ defer_decryption=defer_decryption)
+ signal(SOLEDAD_DONE_DATA_SYNC, self._uuid)
+ return local_gen
+ except Exception as e:
+ client.logger.error("Soledad exception when syncing: %s - %s" % (e.__class__.__name__, e.message))
+
+
+client.Soledad.sync = patched_sync