Added a simple quell command to contrib/ for showing how to use a command to launch other commands (in this case with a lower permission than you normally do (including bypassing superuser status).

This commit is contained in:
Griatch 2011-11-03 18:23:45 +01:00
parent e7b46c89b4
commit b6303808ec
3 changed files with 92 additions and 7 deletions

View file

@ -1,11 +1,16 @@
from weakref import WeakValueDictionary, ref
"""
This is mostly unmodified from the original idmapper.
Evennia changes:
The cache mechanism was changed from a WeakValueDictionary to a
normal dictionary. The old way caused very hard-to-diagnose bugs
over long periods of time (which Evennia requires)
"""
from django.db.models.base import Model, ModelBase
from manager import SharedMemoryManager
TCACHE = {} # test cache, for debugging /Griatch
class SharedMemoryModelBase(ModelBase):
#def __new__(cls, name, bases, attrs):
# super_new = super(ModelBase, cls).__new__
@ -120,7 +125,6 @@ class SharedMemoryModel(Model):
"""
cls._flush_cached_by_key(instance._get_pk_val())
#key = "%s-%s" % (cls, instance.pk)
#del TCACHE[key]
#print "uncached: %s (%s: %s) (total cached: %s)" % (instance, cls.__name__, len(cls.__instance_cache__), len(TCACHE))
flush_cached_instance = classmethod(flush_cached_instance)