lower tags in python, as sqlite doesn't have full unicode tables

This commit is contained in:
Damien Elmes 2009-04-25 03:04:52 +09:00
parent 2944b8194b
commit 61fc7b4430

View file

@ -51,10 +51,8 @@ def tagIds(s, tags):
ids = {}
s.statements("insert or ignore into tags (tag) values (:tag)",
[{'tag': t} for t in tags])
tagsD = dict(s.all("""
select lower(tag), id from tags
tagsD = dict([(x.lower(), y) for (x, y) in s.all("""
select tag, id from tags
where tag in (%s)""" % ",".join([
"'%s'" % t.replace("'", "''") for t in tags])))
for tag in tags:
ids[tag.lower()] = tagsD[tag.lower()]
return ids
"'%s'" % t.replace("'", "''") for t in tags]))])
return tagsD