Catch expressionmatch.NoTokens for filename search

This commit is contained in:
voussoir 2017-05-06 18:37:02 -07:00
parent f8a78c6ee7
commit 091dc82f1e

View file

@ -743,8 +743,13 @@ class PDBPhotoMixin:
tag_match_function = searchhelpers.tag_expression_matcher_builder(frozen_children) tag_match_function = searchhelpers.tag_expression_matcher_builder(frozen_children)
if filename: if filename:
try:
filename_tree = expressionmatch.ExpressionTree.parse(filename) filename_tree = expressionmatch.ExpressionTree.parse(filename)
filename_tree.map(lambda x: x.lower()) filename_tree.map(lambda x: x.lower())
except expressionmatch.NoTokens:
filename_tree = None
else:
filename_tree = None
if give_back_parameters: if give_back_parameters:
parameters = { parameters = {
@ -820,7 +825,7 @@ class PDBPhotoMixin:
#print('Failed author') #print('Failed author')
continue continue
if filename and not filename_tree.evaluate(photo.basename.lower()): if filename_tree and not filename_tree.evaluate(photo.basename.lower()):
#print('Failed filename') #print('Failed filename')
continue continue