Fixed more cleanup of Attibute/Tag/Nick/Permission handlers when object is deleted.

This commit is contained in:
Griatch 2014-04-20 16:47:03 +02:00
parent f521b8129e
commit 972e47e66c
2 changed files with 20 additions and 6 deletions

View file

@ -739,7 +739,6 @@ class ObjectDB(TypedObject):
objects to their respective home locations, as well as clean objects to their respective home locations, as well as clean
up all exits to/from the object. up all exits to/from the object.
""" """
print "object.delete() 1:", self
global _ScriptDB global _ScriptDB
if not _ScriptDB: if not _ScriptDB:
from src.scripts.models import ScriptDB as _ScriptDB from src.scripts.models import ScriptDB as _ScriptDB

View file

@ -353,10 +353,13 @@ class AttributeHandler(object):
given, check the 'attredit' lock on each Attribute before given, check the 'attredit' lock on each Attribute before
continuing. If not given, skip check. continuing. If not given, skip check.
""" """
for attr in self.all(category=category, accessing_obj=accessing_obj, default_access=default_access): if self._cache is None or not _TYPECLASS_AGGRESSIVE_CACHE:
if accessing_obj and not attr.access(accessing_obj, self._attredit, default=default_access): self._recache()
continue if accessing_obj:
attr.delete() [attr.delete() for attr in self._cache.values()
if attr.access(accessing_obj, self._attredit, default=default_access)]
else:
[attr.delete() for attr in self._cache.values()]
self._recache() self._recache()
def all(self, accessing_obj=None, default_access=True): def all(self, accessing_obj=None, default_access=True):
@ -369,7 +372,11 @@ class AttributeHandler(object):
""" """
if self._cache is None or not _TYPECLASS_AGGRESSIVE_CACHE: if self._cache is None or not _TYPECLASS_AGGRESSIVE_CACHE:
self._recache() self._recache()
return self._cache.values() if accessing_obj:
return [attr for attr in self._cache.values()
if attr.access(accessing_obj, self._attredit, default=default_access)]
else:
return self._cache.values()
class NickHandler(AttributeHandler): class NickHandler(AttributeHandler):
""" """
@ -1121,6 +1128,14 @@ class TypedObject(SharedMemoryModel):
if hperm in perms and hpos > ppos) if hperm in perms and hpos > ppos)
return False return False
def delete(self):
"Cleaning up handlers on the typeclass level"
_GA(self, "attributes").clear()
_GA(self, "nicks").clear()
_GA(self, "aliases").clear()
_GA(self, "permissions").clear()
super(TypedObject, self).delete()
# #
# Memory management # Memory management
# #