Revert caching of qualified names. Causing too many problems.
The world is just not ready for it. Was having issues about the parents being deleted / renamed and needing to propogate those changes in a not-ugly way. Will reassess in the future.
This commit is contained in:
parent
0c8a57b6aa
commit
c6b71f1a0d
1 changed files with 4 additions and 11 deletions
|
@ -1157,7 +1157,6 @@ class Tag(ObjectBase, GroupableMixin):
|
||||||
|
|
||||||
self.group_getter = self.photodb.get_tag
|
self.group_getter = self.photodb.get_tag
|
||||||
self.group_getter_many = self.photodb.get_tags_by_id
|
self.group_getter_many = self.photodb.get_tags_by_id
|
||||||
self._cached_qualified_name = None
|
|
||||||
|
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
return self.name == other or ObjectBase.__eq__(self, other)
|
return self.name == other or ObjectBase.__eq__(self, other)
|
||||||
|
@ -1207,7 +1206,6 @@ class Tag(ObjectBase, GroupableMixin):
|
||||||
|
|
||||||
def _uncache(self):
|
def _uncache(self):
|
||||||
self.photodb.caches['tag'].remove(self.id)
|
self.photodb.caches['tag'].remove(self.id)
|
||||||
self._cached_qualified_name = None
|
|
||||||
|
|
||||||
@decorators.required_feature('tag.edit')
|
@decorators.required_feature('tag.edit')
|
||||||
# GroupableMixin.add_child already has @transaction.
|
# GroupableMixin.add_child already has @transaction.
|
||||||
|
@ -1379,15 +1377,11 @@ class Tag(ObjectBase, GroupableMixin):
|
||||||
if len(self.name) > max_len:
|
if len(self.name) > max_len:
|
||||||
return self.name[:max_len]
|
return self.name[:max_len]
|
||||||
|
|
||||||
if self._cached_qualified_name:
|
parent = self.get_parent()
|
||||||
qualname = self._cached_qualified_name
|
if parent is None:
|
||||||
|
qualname = self.name
|
||||||
else:
|
else:
|
||||||
parent = self.get_parent()
|
qualname = parent.qualified_name() + '.' + self.name
|
||||||
if parent is None:
|
|
||||||
qualname = self.name
|
|
||||||
else:
|
|
||||||
qualname = parent.qualified_name() + '.' + self.name
|
|
||||||
self._cached_qualified_name = qualname
|
|
||||||
|
|
||||||
if max_len is None or len(qualname) <= max_len:
|
if max_len is None or len(qualname) <= max_len:
|
||||||
return qualname
|
return qualname
|
||||||
|
@ -1441,7 +1435,6 @@ class Tag(ObjectBase, GroupableMixin):
|
||||||
else:
|
else:
|
||||||
raise exceptions.TagExists(new_name)
|
raise exceptions.TagExists(new_name)
|
||||||
|
|
||||||
self._cached_qualified_name = None
|
|
||||||
self.photodb._cached_frozen_children = None
|
self.photodb._cached_frozen_children = None
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
|
|
Loading…
Reference in a new issue