Added functionality to Attributes to store and update dicts and lists dynamically. One side effect of this is that dicts and tuples need to be stored as custom object types which means that e.g. isintance(obj.db.mylist) == type(list) will return False. In order to do checks like this, use src.utils.utils.inherits_from() instead. The Attribute system now also supports tuples. All other iterables except dicts, lists and tuples are stored and retrieved as lists, same as before.

This fixes issue 189.
This commit is contained in:
Griatch 2011-09-20 12:37:45 +02:00
parent 0af6dff175
commit 475361ad28
4 changed files with 161 additions and 31 deletions

View file

@ -149,7 +149,7 @@ class Evennia(object):
from src.objects.models import ObjectDB
from src.players.models import PlayerDB
print "run_init_hooks:", ObjectDB.get_all_cached_instances()
#print "run_init_hooks:", ObjectDB.get_all_cached_instances()
[(o.typeclass(o), o.at_init()) for o in ObjectDB.get_all_cached_instances()]
[(p.typeclass(p), p.at_init()) for p in PlayerDB.get_all_cached_instances()]