mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 14:32:22 -04:00
ensure we have access to col when removing notes while syncing
This commit is contained in:
parent
19a48fec6a
commit
122c5c8f4c
2 changed files with 3 additions and 3 deletions
|
@ -259,7 +259,7 @@ crt=?, mod=?, scm=?, dty=?, usn=?, ls=?, conf=?""",
|
||||||
strids = ids2str(ids)
|
strids = ids2str(ids)
|
||||||
# we need to log these independently of cards, as one side may have
|
# we need to log these independently of cards, as one side may have
|
||||||
# more card templates
|
# more card templates
|
||||||
runHook("remNotes", ids)
|
runHook("remNotes", self, ids)
|
||||||
self._logRem(ids, REM_NOTE)
|
self._logRem(ids, REM_NOTE)
|
||||||
self.db.execute("delete from notes where id in %s" % strids)
|
self.db.execute("delete from notes where id in %s" % strids)
|
||||||
|
|
||||||
|
|
|
@ -833,13 +833,13 @@ the problem and restart Anki.""")
|
||||||
# Log note deletion
|
# Log note deletion
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
||||||
def onRemNotes(self, nids):
|
def onRemNotes(self, col, nids):
|
||||||
path = os.path.join(self.pm.profileFolder(), "deleted.txt")
|
path = os.path.join(self.pm.profileFolder(), "deleted.txt")
|
||||||
existed = os.path.exists(path)
|
existed = os.path.exists(path)
|
||||||
with open(path, "a") as f:
|
with open(path, "a") as f:
|
||||||
if not existed:
|
if not existed:
|
||||||
f.write("nid\tmid\tfields\n")
|
f.write("nid\tmid\tfields\n")
|
||||||
for id, mid, flds in self.col.db.execute(
|
for id, mid, flds in col.db.execute(
|
||||||
"select id, mid, flds from notes where id in %s" %
|
"select id, mid, flds from notes where id in %s" %
|
||||||
ids2str(nids)):
|
ids2str(nids)):
|
||||||
fields = splitFields(flds)
|
fields = splitFields(flds)
|
||||||
|
|
Loading…
Reference in a new issue