Merge with Kelketek's branch (which also includes dbenoy's branch)
This commit is contained in:
commit
ca11e7de44
8 changed files with 28 additions and 20 deletions
|
|
@ -153,7 +153,7 @@ class CmdSetObjAlias(MuxCommand):
|
||||||
# save back to object.
|
# save back to object.
|
||||||
obj.aliases.add(aliases)
|
obj.aliases.add(aliases)
|
||||||
# we treat this as a re-caching (relevant for exits to re-build their exit commands with the correct aliases)
|
# we treat this as a re-caching (relevant for exits to re-build their exit commands with the correct aliases)
|
||||||
caller.msg("Aliases for '%s' are now %s." % (obj.key, str(obj.aliases)))
|
caller.msg("Alias(es) for '%s' set to %s." % (obj.key, str(obj.aliases)))
|
||||||
|
|
||||||
class CmdCopy(ObjManipCommand):
|
class CmdCopy(ObjManipCommand):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -220,6 +220,7 @@ class CmdGet(MuxCommand):
|
||||||
if not self.args:
|
if not self.args:
|
||||||
caller.msg("Get what?")
|
caller.msg("Get what?")
|
||||||
return
|
return
|
||||||
|
#print "general/get:", caller, caller.location, self.args, caller.location.contents
|
||||||
obj = caller.search(self.args, location=caller.location)
|
obj = caller.search(self.args, location=caller.location)
|
||||||
if not obj:
|
if not obj:
|
||||||
return
|
return
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,12 @@ from django.utils.unittest import TestCase
|
||||||
from src.players.player import Player
|
from src.players.player import Player
|
||||||
from src.utils import create, utils, ansi
|
from src.utils import create, utils, ansi
|
||||||
|
|
||||||
|
from django.db.models.signals import pre_save
|
||||||
|
from src.server.caches import field_pre_save
|
||||||
|
pre_save.connect(field_pre_save, dispatch_uid="fieldcache")
|
||||||
|
|
||||||
|
# set up signal here since we are not starting the server
|
||||||
|
|
||||||
_RE = re.compile(r"^\+|-+\+|\+-+|--*|\|", re.MULTILINE)
|
_RE = re.compile(r"^\+|-+\+|\+-+|--*|\|", re.MULTILINE)
|
||||||
|
|
||||||
#------------------------------------------------------------
|
#------------------------------------------------------------
|
||||||
|
|
@ -171,7 +177,7 @@ class TestBuilding(CommandTest):
|
||||||
CID = 6
|
CID = 6
|
||||||
def test_cmds(self):
|
def test_cmds(self):
|
||||||
self.call(building.CmdCreate(), "/drop TestObj1", "You create a new Object: TestObj1.")
|
self.call(building.CmdCreate(), "/drop TestObj1", "You create a new Object: TestObj1.")
|
||||||
self.call(building.CmdSetObjAlias(), "TestObj1 = TestObj1b","Aliases for 'TestObj1' are now set to testobj1b.")
|
self.call(building.CmdSetObjAlias(), "TestObj1 = TestObj1b","Alias(es) for 'TestObj1' set to testobj1b.")
|
||||||
self.call(building.CmdCopy(), "TestObj1 = TestObj2;TestObj2b, TestObj3;TestObj3b", "Copied TestObj1 to 'TestObj3' (aliases: ['TestObj3b']")
|
self.call(building.CmdCopy(), "TestObj1 = TestObj2;TestObj2b, TestObj3;TestObj3b", "Copied TestObj1 to 'TestObj3' (aliases: ['TestObj3b']")
|
||||||
self.call(building.CmdSetAttribute(), "Obj6/test1=\"value1\"", "Created attribute Obj6/test1 = \"value1\"")
|
self.call(building.CmdSetAttribute(), "Obj6/test1=\"value1\"", "Created attribute Obj6/test1 = \"value1\"")
|
||||||
self.call(building.CmdSetAttribute(), "Obj6b/test2=\"value2\"", "Created attribute Obj6b/test2 = \"value2\"")
|
self.call(building.CmdSetAttribute(), "Obj6b/test2=\"value2\"", "Created attribute Obj6b/test2 = \"value2\"")
|
||||||
|
|
|
||||||
|
|
@ -792,6 +792,7 @@ class ObjectDB(TypedObject):
|
||||||
|
|
||||||
# Perform move
|
# Perform move
|
||||||
try:
|
try:
|
||||||
|
#print "move_to location:", destination
|
||||||
_SA(self, "location", destination)
|
_SA(self, "location", destination)
|
||||||
except Exception:
|
except Exception:
|
||||||
emit_to_obj.msg(errtxt % "location change")
|
emit_to_obj.msg(errtxt % "location change")
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ else:
|
||||||
|
|
||||||
def hashid(obj, suffix=""):
|
def hashid(obj, suffix=""):
|
||||||
"""
|
"""
|
||||||
Returns a per-class unique that combines the object's
|
Returns a per-class unique hash that combines the object's
|
||||||
class name with its idnum and creation time. This makes this id unique also
|
class name with its idnum and creation time. This makes this id unique also
|
||||||
between different typeclassed entities such as scripts and
|
between different typeclassed entities such as scripts and
|
||||||
objects (which may still have the same id).
|
objects (which may still have the same id).
|
||||||
|
|
|
||||||
|
|
@ -130,20 +130,20 @@ class Attribute(SharedMemoryModel):
|
||||||
# value = self.attr and del self.attr respectively (where self
|
# value = self.attr and del self.attr respectively (where self
|
||||||
# is the object in question).
|
# is the object in question).
|
||||||
|
|
||||||
# key property (wraps db_key)
|
## key property (wraps db_key)
|
||||||
#@property
|
##@property
|
||||||
def __key_get(self):
|
#def __key_get(self):
|
||||||
"Getter. Allows for value = self.key"
|
# "Getter. Allows for value = self.key"
|
||||||
return get_field_cache(self, "key")
|
# return get_field_cache(self, "key")
|
||||||
#@key.setter
|
##@key.setter
|
||||||
def __key_set(self, value):
|
#def __key_set(self, value):
|
||||||
"Setter. Allows for self.key = value"
|
# "Setter. Allows for self.key = value"
|
||||||
set_field_cache(self, "key", value)
|
# set_field_cache(self, "key", value)
|
||||||
#@key.deleter
|
##@key.deleter
|
||||||
def __key_del(self):
|
#def __key_del(self):
|
||||||
"Deleter. Allows for del self.key"
|
# "Deleter. Allows for del self.key"
|
||||||
raise Exception("Cannot delete attribute key!")
|
# raise Exception("Cannot delete attribute key!")
|
||||||
key = property(__key_get, __key_set, __key_del)
|
#key = property(__key_get, __key_set, __key_del)
|
||||||
|
|
||||||
# obj property (wraps db_obj)
|
# obj property (wraps db_obj)
|
||||||
#@property
|
#@property
|
||||||
|
|
@ -232,7 +232,7 @@ class Attribute(SharedMemoryModel):
|
||||||
#
|
#
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return smart_str("%s(%s)" % (_GA(self, "db_key", _GA(self, "id"))))
|
return smart_str("%s(%s)" % (_GA(self, "db_key"), _GA(self, "id")))
|
||||||
|
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return u"%s(%s)" % (_GA(self, "db_key", _GA(self, "id")))
|
return u"%s(%s)" % (_GA(self, "db_key", _GA(self, "id")))
|
||||||
|
|
|
||||||
|
|
@ -137,9 +137,8 @@ def create_object(typeclass, key=None, location=None,
|
||||||
else:
|
else:
|
||||||
new_object.home = settings.CHARACTER_DEFAULT_HOME
|
new_object.home = settings.CHARACTER_DEFAULT_HOME
|
||||||
|
|
||||||
|
|
||||||
if location:
|
if location:
|
||||||
new_object.move_to(location, quiet=True)
|
new_object.move_to(location, quiet=True)
|
||||||
else:
|
else:
|
||||||
# rooms would have location=None.
|
# rooms would have location=None.
|
||||||
new_object.location = None
|
new_object.location = None
|
||||||
|
|
|
||||||
|
|
@ -96,6 +96,7 @@ class SharedMemoryModelBase(ModelBase):
|
||||||
|
|
||||||
def _set(cls, fname, value):
|
def _set(cls, fname, value):
|
||||||
"Wrapper for setting database field"
|
"Wrapper for setting database field"
|
||||||
|
#print "_set:", fname
|
||||||
if hasattr(value, "dbobj"):
|
if hasattr(value, "dbobj"):
|
||||||
value = _GA(value, "dbobj")
|
value = _GA(value, "dbobj")
|
||||||
elif isinstance(value, basestring) and (value.isdigit() or value.startswith("#")):
|
elif isinstance(value, basestring) and (value.isdigit() or value.startswith("#")):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue