When destroying a new-style Element, reuse the delete_facet method
instead of deleting keys from the origin. Within the delete_facet
method, make sure to delete the corresponding key from the facethash
too.
if self.old_style:
del self.origin.data[self.key]
else:
if self.old_style:
del self.origin.data[self.key]
else:
- for facet in self.facethash:
- del self.origin.data[".".join((self.key, facet))]
+ for facet in dict(self.facethash):
+ self.remove_facet(facet)
del self.universe.categories[self.category][self.subkey]
del self.universe.contents[self.key]
del self
del self.universe.categories[self.category][self.subkey]
del self.universe.contents[self.key]
del self
def remove_facet(self, facet):
"""Remove a facet from the element."""
def remove_facet(self, facet):
"""Remove a facet from the element."""
- if self.has_facet(facet):
- del(self.origin.data[self.key][facet])
- self.origin.modified = True
+ if self.old_style and self.has_facet(facet):
+ del self.origin.data[self.key][facet]
+ elif ".".join((self.key, facet)) in self.origin.data:
+ del self.origin.data[".".join((self.key, facet))]
+ if facet in self.facethash:
+ del self.facethash[facet]
+ self.origin.modified = True
def ancestry(self):
"""Return a list of the element's inheritance lineage."""
def ancestry(self):
"""Return a list of the element's inheritance lineage."""