Revert 488d793, reinstate PhotoDB.normalize_tagname.

In that commit, I missed three more calls in objects.py and
now I'm deciding that 5x copy-paste is not worth it.
This commit is contained in:
voussoir 2019-06-15 16:49:52 -07:00
parent 8063f338f8
commit 947d05a4fa

View file

@ -840,12 +840,7 @@ class PDBTagMixin:
# At the same time, I don't want to just pass the input directly
# into the query, we should still do SOME assumed normalization
# like whitespace strip.
tagname = objects.Tag.normalize_name(
tagname,
valid_chars=self.config['tag']['valid_chars'],
min_length=self.config['tag']['min_length'],
max_length=self.config['tag']['max_length'],
)
tagname = self.normalize_tagname(tagname)
except (exceptions.TagTooShort, exceptions.TagTooLong):
raise exceptions.NoSuchTag(tagname)
@ -883,12 +878,7 @@ class PDBTagMixin:
Register a new tag and return the Tag object.
'''
# These might raise exceptions.
tagname = objects.Tag.normalize_name(
tagname,
valid_chars=self.config['tag']['valid_chars'],
min_length=self.config['tag']['min_length'],
max_length=self.config['tag']['max_length'],
)
tagname = self.normalize_tagname(tagname)
self.assert_no_such_tag(name=tagname)
description = objects.Tag.normalize_description(description)
@ -915,6 +905,15 @@ class PDBTagMixin:
self.commit(message='new tag')
return tag
def normalize_tagname(self, tagname):
tagname = objects.Tag.normalize_name(
tagname,
valid_chars=self.config['tag']['valid_chars'],
min_length=self.config['tag']['min_length'],
max_length=self.config['tag']['max_length'],
)
return tagname
class PDBUserMixin:
def __init__(self):