Merge pull request #88 from dobefore/no_attribute_err_43

This commit is contained in:
Vikash Kothary 2021-06-02 21:41:52 +01:00 committed by GitHub
commit 5687598432
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 5 deletions

View File

@ -10,6 +10,7 @@ import random
import requests
import json
import os
from typing import List,Tuple
from anki.db import DB, DBError
from anki.utils import ids2str, intTime, platDesc, checksum, devMode
@ -83,7 +84,7 @@ class Syncer(object):
for g in self.col.decks.all():
if g['usn'] == -1:
return "deck had usn = -1"
for t, usn in self.col.tags.allItems():
for t, usn in self.allItems():
if usn == -1:
return "tag had usn = -1"
found = False
@ -276,10 +277,12 @@ from notes where %s""" % lim, self.maxUsn)
# Tags
##########################################################################
def allItems(self) -> List[Tuple[str, int]]:
tags=self.col.db.execute("select tag, usn from tags")
return [(tag, int(usn)) for tag,usn in tags]
def getTags(self):
tags = []
for t, usn in self.col.tags.allItems():
for t, usn in self.allItems():
if usn == -1:
self.col.tags.tags[t] = self.maxUsn
tags.append(t)
@ -331,7 +334,9 @@ from notes where %s""" % lim, self.maxUsn)
return self.col.conf
def mergeConf(self, conf):
self.col.backend.set_all_config(json.dumps(conf).encode())
for key, value in conf.items():
self.col.set_config(key, value)
# self.col.backend.set_all_config(json.dumps(conf).encode())
# Wrapper for requests that tracks upload/download progress
##########################################################################

View File

@ -178,7 +178,7 @@ class SyncCollectionHandler(Syncer):
]
def getTags(self):
return [t for t, usn in self.col.tags.allItems()
return [t for t, usn in self.allItems()
if usn >= self.minUsn]
class SyncMediaHandler: