Made scripts and typeclassed objects remember db_typeclass_path at all times - a temporarily faulty typeclass will no longer mess up things forever after. Refined and optimized the way typeclasses are cached and loaded, minimizing db hits. The default result when trying to create an object or script with a typeclass that is faulty/not found is now to fail. The previous way, to create an entity anyway using defaults was hard to debug and caused confusion. Resolves issue 175.

This commit is contained in:
Griatch 2011-08-06 18:15:04 +00:00
parent 6cb2b8b745
commit ddfd8120bb
10 changed files with 208 additions and 173 deletions

View file

@ -101,8 +101,11 @@ class SharedMemoryModel(Model):
"""
if instance._get_pk_val() is not None:
cls.__instance_cache__[instance._get_pk_val()] = instance
if hasattr(instance, 'at_cache') and callable(instance.at_cache):
instance.at_cache()
try:
object.__getattribute__(instance, "at_cache")()
except (TypeError, AttributeError):
pass
#key = "%s-%s" % (cls, instance.pk)
#TCACHE[key] = instance
#print "cached: %s (%s: %s) (total cached: %s)" % (instance, cls.__name__, len(cls.__instance_cache__), len(TCACHE))