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.strip('.+')
tagname = tagname.split('.')[-1].split('+')[0] tagname = tagname.split('.')[-1].split('+')[0]
try:
tagname = self.normalize_tagname(tagname) tagname = self.normalize_tagname(tagname)
except (exceptions.TagTooShort, exceptions.TagTooLong):
raise exceptions.NoSuchTag(tagname)
cur = self.sql.cursor() cur = self.sql.cursor()
while True: while True:

View file

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