make sure values are unicode

This commit is contained in:
j 2014-05-27 16:20:14 +02:00
parent 93fcdc60ac
commit 7430d1b483

View file

@ -169,6 +169,8 @@ class Item(db.Model):
def add(k, v): def add(k, v):
f = Find(item_id=self.id, key=k) f = Find(item_id=self.id, key=k)
if isinstance(v, str):
v = v.decode('utf-8')
f.findvalue = unicodedata.normalize('NFKD', v).lower() f.findvalue = unicodedata.normalize('NFKD', v).lower()
f.value = v f.value = v
db.session.add(f) db.session.add(f)