summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--server/src/leap/soledad/server/__init__.py16
-rw-r--r--server/src/leap/soledad/server/_version.py17
-rw-r--r--server/src/leap/soledad/server/sync.py9
3 files changed, 22 insertions, 20 deletions
diff --git a/server/src/leap/soledad/server/__init__.py b/server/src/leap/soledad/server/__init__.py
index adb5b561..7a03f6fb 100644
--- a/server/src/leap/soledad/server/__init__.py
+++ b/server/src/leap/soledad/server/__init__.py
@@ -92,16 +92,13 @@ import sys
from u1db.remote import http_app, utils
+from ._version import get_versions
+
# Keep OpenSSL's tsafe before importing Twisted submodules so we can put
# it back if Twisted==12.0.0 messes with it.
from OpenSSL import tsafe
-old_tsafe = tsafe
from twisted import version
-if version.base() == "12.0.0":
- # Put OpenSSL's tsafe back into place. This can probably be removed if we
- # come to use Twisted>=12.3.0.
- sys.modules['OpenSSL.tsafe'] = old_tsafe
from leap.soledad.server.auth import SoledadTokenAuthMiddleware
from leap.soledad.server.gzip_middleware import GzipMiddleware
@@ -115,11 +112,18 @@ from leap.soledad.server.sync import (
from leap.soledad.common import SHARED_DB_NAME
from leap.soledad.common.couch import CouchServerState
+old_tsafe = tsafe
+
+if version.base() == "12.0.0":
+ # Put OpenSSL's tsafe back into place. This can probably be removed if we
+ # come to use Twisted>=12.3.0.
+ sys.modules['OpenSSL.tsafe'] = old_tsafe
# ----------------------------------------------------------------------------
# Soledad WSGI application
# ----------------------------------------------------------------------------
+
class SoledadApp(http_app.HTTPApp):
"""
Soledad WSGI application
@@ -303,7 +307,5 @@ def application(environ, start_response):
return application(environ, start_response)
-
-from ._version import get_versions
__version__ = get_versions()['version']
del get_versions
diff --git a/server/src/leap/soledad/server/_version.py b/server/src/leap/soledad/server/_version.py
index ec611c39..61bb57d9 100644
--- a/server/src/leap/soledad/server/_version.py
+++ b/server/src/leap/soledad/server/_version.py
@@ -1,5 +1,3 @@
-
-IN_LONG_VERSION_PY = True
# This file helps to compute a version number in source trees obtained from
# git-archive tarball (such as those provided by githubs download-from-tag
# feature). Distribution tarballs (build by setup.py sdist) and build
@@ -10,12 +8,16 @@ IN_LONG_VERSION_PY = True
# versioneer-0.7+ (https://github.com/warner/python-versioneer)
# these strings will be replaced by git during git-archive
-git_refnames = "$Format:%d$"
-git_full = "$Format:%H$"
-
import subprocess
import sys
+import re
+import os.path
+
+IN_LONG_VERSION_PY = True
+
+git_refnames = "$Format:%d$"
+git_full = "$Format:%H$"
def run_command(args, cwd=None, verbose=False):
@@ -37,9 +39,6 @@ def run_command(args, cwd=None, verbose=False):
return None
return stdout
-import re
-import os.path
-
def get_expanded_variables(versionfile_source):
# the code embedded in _version.py can just fetch the value of these
@@ -85,7 +84,7 @@ def versions_from_expanded_variables(variables, tag_prefix, verbose=False):
# "stabilization", as well as "HEAD" and "master".
tags = set([r for r in refs if re.search(r'\d', r)])
if verbose:
- print("discarding '%s', no digits" % ",".join(refs-tags))
+ print("discarding '%s', no digits" % ",".join(refs - tags))
if verbose:
print("likely tags: %s" % ",".join(sorted(tags)))
for ref in sorted(tags):
diff --git a/server/src/leap/soledad/server/sync.py b/server/src/leap/soledad/server/sync.py
index 6dc99b5a..d2db9055 100644
--- a/server/src/leap/soledad/server/sync.py
+++ b/server/src/leap/soledad/server/sync.py
@@ -224,7 +224,6 @@ class SyncExchange(sync.SyncExchange):
self._sync_state = ServerSyncState(
self._db, self.source_replica_uid, sync_id)
-
def find_changes_to_return(self, received):
"""
Find changes to return.
@@ -286,7 +285,8 @@ class SyncExchange(sync.SyncExchange):
doc = self._db.get_doc(changed_doc_id, include_deleted=True)
return_doc_cb(doc, gen, trans_id)
- def insert_doc_from_source(self, doc, source_gen, trans_id,
+ def insert_doc_from_source(
+ self, doc, source_gen, trans_id,
number_of_docs=None, doc_idx=None, sync_id=None):
"""Try to insert synced document from source.
@@ -371,8 +371,9 @@ class SyncResource(http_app.SyncResource):
self._sync_id = sync_id
@http_app.http_method(content_as_args=True)
- def post_put(self, id, rev, content, gen, trans_id, number_of_docs,
- doc_idx):
+ def post_put(
+ self, id, rev, content, gen,
+ trans_id, number_of_docs, doc_idx):
"""
Put one incoming document into the server replica.