ensure we have access to col when removing notes while syncing

This commit is contained in:
Damien Elmes 2013-05-31 10:42:24 +09:00
parent 19a48fec6a
commit 122c5c8f4c
2 changed files with 3 additions and 3 deletions

View file

@ -259,7 +259,7 @@ crt=?, mod=?, scm=?, dty=?, usn=?, ls=?, conf=?""",
strids = ids2str(ids)
# we need to log these independently of cards, as one side may have
# more card templates
runHook("remNotes", ids)
runHook("remNotes", self, ids)
self._logRem(ids, REM_NOTE)
self.db.execute("delete from notes where id in %s" % strids)

View file

@ -833,13 +833,13 @@ the problem and restart Anki.""")
# Log note deletion
##########################################################################
def onRemNotes(self, nids):
def onRemNotes(self, col, nids):
path = os.path.join(self.pm.profileFolder(), "deleted.txt")
existed = os.path.exists(path)
with open(path, "a") as f:
if not existed:
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" %
ids2str(nids)):
fields = splitFields(flds)