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:
parent
8063f338f8
commit
947d05a4fa
1 changed files with 11 additions and 12 deletions
|
@ -840,12 +840,7 @@ class PDBTagMixin:
|
||||||
# At the same time, I don't want to just pass the input directly
|
# At the same time, I don't want to just pass the input directly
|
||||||
# into the query, we should still do SOME assumed normalization
|
# into the query, we should still do SOME assumed normalization
|
||||||
# like whitespace strip.
|
# like whitespace strip.
|
||||||
tagname = objects.Tag.normalize_name(
|
tagname = self.normalize_tagname(tagname)
|
||||||
tagname,
|
|
||||||
valid_chars=self.config['tag']['valid_chars'],
|
|
||||||
min_length=self.config['tag']['min_length'],
|
|
||||||
max_length=self.config['tag']['max_length'],
|
|
||||||
)
|
|
||||||
except (exceptions.TagTooShort, exceptions.TagTooLong):
|
except (exceptions.TagTooShort, exceptions.TagTooLong):
|
||||||
raise exceptions.NoSuchTag(tagname)
|
raise exceptions.NoSuchTag(tagname)
|
||||||
|
|
||||||
|
@ -883,12 +878,7 @@ class PDBTagMixin:
|
||||||
Register a new tag and return the Tag object.
|
Register a new tag and return the Tag object.
|
||||||
'''
|
'''
|
||||||
# These might raise exceptions.
|
# These might raise exceptions.
|
||||||
tagname = objects.Tag.normalize_name(
|
tagname = self.normalize_tagname(tagname)
|
||||||
tagname,
|
|
||||||
valid_chars=self.config['tag']['valid_chars'],
|
|
||||||
min_length=self.config['tag']['min_length'],
|
|
||||||
max_length=self.config['tag']['max_length'],
|
|
||||||
)
|
|
||||||
self.assert_no_such_tag(name=tagname)
|
self.assert_no_such_tag(name=tagname)
|
||||||
|
|
||||||
description = objects.Tag.normalize_description(description)
|
description = objects.Tag.normalize_description(description)
|
||||||
|
@ -915,6 +905,15 @@ class PDBTagMixin:
|
||||||
self.commit(message='new tag')
|
self.commit(message='new tag')
|
||||||
return 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:
|
class PDBUserMixin:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
Loading…
Reference in a new issue