Fix add_child prefer specific photo tags.

And by fix I mean the old code wasn't even calling the method.
This commit is contained in:
voussoir 2021-02-28 12:32:40 -08:00
parent 400c255aea
commit cc79a4945d
No known key found for this signature in database
GPG key ID: 5F7554F8C26DACCB

View file

@ -1447,8 +1447,8 @@ class Tag(ObjectBase, GroupableMixin):
def _uncache(self): def _uncache(self):
self.photodb.caches['tag'].remove(self.id) self.photodb.caches['tag'].remove(self.id)
def _add_child(self, member): def __add_child(self, member):
ret = super()._add_child(member) ret = super().add_child(member)
if ret is BAIL: if ret is BAIL:
return BAIL return BAIL
@ -1471,19 +1471,23 @@ class Tag(ObjectBase, GroupableMixin):
@decorators.required_feature('tag.edit') @decorators.required_feature('tag.edit')
@decorators.transaction @decorators.transaction
def add_child(self, *args, **kwargs): def add_child(self, member):
ret = super().add_child(*args, **kwargs) ret = self.__add_child(member)
if ret is BAIL: if ret is BAIL:
return return BAIL
self.photodb.caches['tag_exports'].clear() self.photodb.caches['tag_exports'].clear()
return ret return ret
@decorators.required_feature('tag.edit') @decorators.required_feature('tag.edit')
@decorators.transaction @decorators.transaction
def add_children(self, *args, **kwargs): def add_children(self, members):
ret = super().add_children(*args, **kwargs) bail = True
if ret is BAIL: for member in members:
return bail = (self.__add_child(member) is BAIL) and bail
if bail:
return BAIL
self.photodb.caches['tag_exports'].clear() self.photodb.caches['tag_exports'].clear()
return ret return ret