Let PDB.get_tag convert normalization errors to NoSuch.

Instead of having to account for them on the other end,
since they don't care about that stuff anyway.
This commit is contained in:
voussoir 2018-03-21 11:03:58 -07:00
parent 7b4ae3045a
commit 1d76b4511b
2 changed files with 6 additions and 7 deletions

View file

@ -831,7 +831,11 @@ class PDBTagMixin:
tagname = tagname.strip('.+')
tagname = tagname.split('.')[-1].split('+')[0]
tagname = self.normalize_tagname(tagname)
try:
tagname = self.normalize_tagname(tagname)
except (exceptions.TagTooShort, exceptions.TagTooLong):
raise exceptions.NoSuchTag(tagname)
cur = self.sql.cursor()
while True:

View file

@ -423,12 +423,7 @@ def normalize_tag_mmf(tags, photodb, warning_bag=None):
try:
tag = photodb.get_tag(name=tag)
exc = None
except exceptions.NoSuchTag as e:
exc = e
except (exceptions.TagTooShort, exceptions.TagTooLong) as e:
exc = exceptions.NoSuchTag(tag)
if exc is not None:
except exceptions.NoSuchTag as exc:
if warning_bag:
warning_bag.add(exc.error_message)
continue