mirror of
https://github.com/ankitects/anki.git
synced 2025-09-20 06:52:21 -04:00
lower tags in python, as sqlite doesn't have full unicode tables
This commit is contained in:
parent
2944b8194b
commit
61fc7b4430
1 changed files with 4 additions and 6 deletions
10
anki/tags.py
10
anki/tags.py
|
@ -51,10 +51,8 @@ def tagIds(s, tags):
|
||||||
ids = {}
|
ids = {}
|
||||||
s.statements("insert or ignore into tags (tag) values (:tag)",
|
s.statements("insert or ignore into tags (tag) values (:tag)",
|
||||||
[{'tag': t} for t in tags])
|
[{'tag': t} for t in tags])
|
||||||
tagsD = dict(s.all("""
|
tagsD = dict([(x.lower(), y) for (x, y) in s.all("""
|
||||||
select lower(tag), id from tags
|
select tag, id from tags
|
||||||
where tag in (%s)""" % ",".join([
|
where tag in (%s)""" % ",".join([
|
||||||
"'%s'" % t.replace("'", "''") for t in tags])))
|
"'%s'" % t.replace("'", "''") for t in tags]))])
|
||||||
for tag in tags:
|
return tagsD
|
||||||
ids[tag.lower()] = tagsD[tag.lower()]
|
|
||||||
return ids
|
|
||||||
|
|
Loading…
Reference in a new issue