From f03aea67c1e0432b4f644756dd06712eb154ee73 Mon Sep 17 00:00:00 2001 From: Christoph Mack Date: Tue, 19 Jan 2016 11:20:37 +0100 Subject: [PATCH] SyncMediaHandler.begin(): return media database usn instead of collection database usn. If the wrong usn is returned, media syncing on the client will not finish with status "noChanges" even if there have been no changes since the last media sync. --- ankisyncd/sync_app.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/ankisyncd/sync_app.py b/ankisyncd/sync_app.py index 982f933..5d55aca 100644 --- a/ankisyncd/sync_app.py +++ b/ankisyncd/sync_app.py @@ -90,7 +90,13 @@ class SyncMediaHandler(MediaSyncer): MediaSyncer.__init__(self, col) def begin(self, skey): - return json.dumps({'data':{'sk':skey, 'usn':self.col._usn}, 'err':''}) + return json.dumps({ + 'data':{ + 'sk':skey, + 'usn':self.col.media.lastUsn() + }, + 'err':'' + }) def uploadChanges(self, data, skey): """Adds files based from ZIP file data and returns the usn.""" @@ -257,7 +263,6 @@ class SimpleUserManager(object): def authenticate(self, username, password): """ Returns True if this username is allowed to connect with this password. False otherwise. - Override this to change how users are authenticated. """ @@ -266,7 +271,6 @@ class SimpleUserManager(object): def username2dirname(self, username): """ Returns the directory name for the given user. By default, this is just the username. - Override this to adjust the mapping between users and their directory. """ @@ -669,4 +673,4 @@ def main(): finally: shutdown() -if __name__ == '__main__': main() +if __name__ == '__main__': main() \ No newline at end of file