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.
This commit is contained in:
Christoph Mack 2016-01-19 11:20:37 +01:00 committed by jdoe0
parent 3baad9cfac
commit f03aea67c1

View File

@ -90,7 +90,13 @@ class SyncMediaHandler(MediaSyncer):
MediaSyncer.__init__(self, col) MediaSyncer.__init__(self, col)
def begin(self, skey): 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): def uploadChanges(self, data, skey):
"""Adds files based from ZIP file data and returns the usn.""" """Adds files based from ZIP file data and returns the usn."""
@ -257,7 +263,6 @@ class SimpleUserManager(object):
def authenticate(self, username, password): def authenticate(self, username, password):
""" """
Returns True if this username is allowed to connect with this password. False otherwise. Returns True if this username is allowed to connect with this password. False otherwise.
Override this to change how users are authenticated. Override this to change how users are authenticated.
""" """
@ -266,7 +271,6 @@ class SimpleUserManager(object):
def username2dirname(self, username): def username2dirname(self, username):
""" """
Returns the directory name for the given user. By default, this is just the 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. Override this to adjust the mapping between users and their directory.
""" """
@ -669,4 +673,4 @@ def main():
finally: finally:
shutdown() shutdown()
if __name__ == '__main__': main() if __name__ == '__main__': main()