Trunk: Merged the Devel-branch (branches/griatch) into /trunk. This constitutes a major refactoring of Evennia. Development will now continue in trunk. See the wiki and the past posts to the mailing list for info. /Griatch
This commit is contained in:
parent
df29defbcd
commit
f83c2bddf8
222 changed files with 22304 additions and 14371 deletions
15
src/utils/idmapper/manager.py
Executable file
15
src/utils/idmapper/manager.py
Executable file
|
|
@ -0,0 +1,15 @@
|
|||
from django.db.models.manager import Manager
|
||||
|
||||
class SharedMemoryManager(Manager):
|
||||
# TODO: improve on this implementation
|
||||
# We need a way to handle reverse lookups so that this model can
|
||||
# still use the singleton cache, but the active model isn't required
|
||||
# to be a SharedMemoryModel.
|
||||
def get(self, **kwargs):
|
||||
items = kwargs.keys()
|
||||
inst = None
|
||||
if len(items) == 1 and items[0] in ('pk', self.model._meta.pk.attname):
|
||||
inst = self.model.get_cached_instance(kwargs[items[0]])
|
||||
if inst is None:
|
||||
inst = super(SharedMemoryManager, self).get(**kwargs)
|
||||
return inst
|
||||
Loading…
Add table
Add a link
Reference in a new issue