Fix tag_expression usage of frozen_children which was tag objects.

At some point, I changed tag_export.flat_dict from using strings as
keys to using actual Tag objects as keys. The tag expression handler
never got updated, so frozen_children[tagname] raised KeyError as
it was looking for a string.
I considered using tag_expression_tree.map to convert all the tree
tokens into tag objects, but when we render the tree back into text
it will say "Tag:name" instead of just "name" throughout the whole
expression, and I don't want to deal with converting those back.
This commit is contained in:
voussoir 2020-09-09 12:58:57 -07:00
parent 30d7dbdb39
commit 8ed5f0be51

View file

@ -484,6 +484,10 @@ def tag_expression_tree_builder(
return expression_tree
def tag_expression_matcher_builder(frozen_children):
frozen_children = {
(tag.name if not isinstance(tag, str) else tag): children
for (tag, children) in frozen_children.items()
}
def match_function(photo_tags, tagname):
'''
Used as the `match_function` for the ExpressionTree evaluation.