Key:lit should not match lit=no

This commit is contained in:
Edward Betts 2021-06-25 14:59:48 +02:00
parent 34b2d0fa05
commit 3f18ea2816

View file

@ -1,4 +1,4 @@
from sqlalchemy import func, or_ from sqlalchemy import func, or_, and_
from sqlalchemy.orm import selectinload from sqlalchemy.orm import selectinload
from matcher import model, database, wikidata_api, wikidata from matcher import model, database, wikidata_api, wikidata
from matcher.data import extra_keys from matcher.data import extra_keys
@ -237,7 +237,8 @@ def get_tag_filter(cls, tag_list):
tag_filter = [] tag_filter = []
for tag_or_key in tag_list: for tag_or_key in tag_list:
if tag_or_key.startswith("Key:"): if tag_or_key.startswith("Key:"):
tag_filter.append(cls.tags.has_key(tag_or_key[4:])) tag_filter.append(and_(cls.tags.has_key(tag_or_key[4:]),
cls.tags[tag_or_key[4:]] != 'no'))
if tag_or_key.startswith("Tag:"): if tag_or_key.startswith("Tag:"):
k, _, v = tag_or_key.partition("=") k, _, v = tag_or_key.partition("=")
tag_filter.append(cls.tags[k[4:]] == v) tag_filter.append(cls.tags[k[4:]] == v)