Apply @ndl's patches

The patches fix the issue where syncing across different profiles will
always trigger a full sync if there's any change in either of the
profiles.
This commit is contained in:
jdoe0
2016-11-03 21:44:40 +07:00
parent 1678890d3d
commit c398ccdb89
7 changed files with 59 additions and 15 deletions

View File

@@ -59,7 +59,7 @@ class CollectionWrapper(object):
else:
raise
col = anki.storage.Collection(self.path)
col = anki.storage.Collection(self.path, server=True)
# Do any special setup
if self.setup_new_collection is not None:
@@ -71,7 +71,7 @@ class CollectionWrapper(object):
"""Open the collection, or create it if it doesn't exist."""
if self.__col is None:
if os.path.exists(self.path):
self.__col = anki.storage.Collection(self.path)
self.__col = anki.storage.Collection(self.path, server=True)
else:
self.__col = self.__create_collection()

View File

@@ -425,6 +425,7 @@ class SyncApp(object):
fd.write(data)
finally:
col.reopen()
col.load()
# run hook_upload if one is defined
if self.hook_upload is not None:
@@ -442,6 +443,7 @@ class SyncApp(object):
data = open(session.get_collection_path(), 'rb').read()
finally:
col.reopen()
col.load()
return data
@wsgify