Implement applyGraves
This commit is contained in:
parent
3e26fab3a3
commit
0b9f30adea
@ -71,7 +71,7 @@ def old_client(cv):
|
|||||||
|
|
||||||
|
|
||||||
class SyncCollectionHandler(anki.sync.Syncer):
|
class SyncCollectionHandler(anki.sync.Syncer):
|
||||||
operations = ['meta', 'applyChanges', 'start', 'chunk', 'applyChunk', 'sanityCheck2', 'finish']
|
operations = ['meta', 'applyChanges', 'start', 'applyGraves', 'chunk', 'applyChunk', 'sanityCheck2', 'finish']
|
||||||
|
|
||||||
def __init__(self, col):
|
def __init__(self, col):
|
||||||
# So that 'server' (the 3rd argument) can't get set
|
# So that 'server' (the 3rd argument) can't get set
|
||||||
@ -95,7 +95,9 @@ class SyncCollectionHandler(anki.sync.Syncer):
|
|||||||
def usnLim(self):
|
def usnLim(self):
|
||||||
return "usn >= %d" % self.minUsn
|
return "usn >= %d" % self.minUsn
|
||||||
|
|
||||||
def start(self, minUsn, lnewer, graves):
|
# ankidesktop >=2.1rc2 sends graves in applyGraves, but still expects
|
||||||
|
# server-side deletions to be returned by start
|
||||||
|
def start(self, minUsn, lnewer, graves={"cards": [], "notes": [], "decks": []}):
|
||||||
self.maxUsn = self.col._usn
|
self.maxUsn = self.col._usn
|
||||||
self.minUsn = minUsn
|
self.minUsn = minUsn
|
||||||
self.lnewer = not lnewer
|
self.lnewer = not lnewer
|
||||||
@ -103,6 +105,10 @@ class SyncCollectionHandler(anki.sync.Syncer):
|
|||||||
self.remove(graves)
|
self.remove(graves)
|
||||||
return lgraves
|
return lgraves
|
||||||
|
|
||||||
|
def applyGraves(self, chunk):
|
||||||
|
print(f"applyGraves chunk: {chunk}")
|
||||||
|
self.remove(chunk)
|
||||||
|
|
||||||
def applyChanges(self, changes):
|
def applyChanges(self, changes):
|
||||||
self.rchg = changes
|
self.rchg = changes
|
||||||
lchg = self.changes()
|
lchg = self.changes()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user