Server can be connected to, not yet get to a command line; may need to work on different app_labels.

This commit is contained in:
Griatch 2014-12-22 23:03:00 +01:00
parent 0b5e2b94ff
commit 749715a193
5 changed files with 33 additions and 37 deletions

View file

@ -252,14 +252,14 @@ class ObjectDB(TypedObject):
raise RuntimeError
elif loc == None:
raise RuntimeWarning
return is_loc_loop(_GA(_GA(loc, "dbobj"), "db_location"), depth + 1)
return is_loc_loop(loc.db_location, depth + 1)
try:
is_loc_loop(location)
except RuntimeWarning:
pass
# actually set the field
_SA(_GA(self, "dbobj"), "db_location", _GA(location, "dbobj") if location else location)
_GA(_GA(self, "dbobj"), "save")(update_fields=["db_location"])
self.db_location = location
self.save(update_fields=["db_location"])
except RuntimeError:
errmsg = "Error: %s.location = %s creates a location loop." % (self.key, location)
logger.log_errmsg(errmsg)
@ -271,8 +271,8 @@ class ObjectDB(TypedObject):
def __location_del(self):
"Cleanly delete the location reference"
_SA(_GA(self, "dbobj"), "db_location", None)
_GA(_GA(self, "dbobj"), "save")(upate_fields=["db_location"])
self.db_location = None
self.save(update_fields=["db_location"])
location = property(__location_get, __location_set, __location_del)
class Meta:
@ -323,8 +323,7 @@ class ObjectDB(TypedObject):
exclude is one or more objects to not return
"""
if exclude:
exclude = [obj.dbobj for obj in make_iter(exclude)]
return ObjectDB.objects.get_contents(self, excludeobj=exclude)
return ObjectDB.objects.get_contents(self, excludeobj=make_iter(exclude))
return ObjectDB.objects.get_contents(self)
contents = property(contents_get)
@ -423,7 +422,7 @@ class ObjectDB(TypedObject):
# location(s) were given
candidates = []
for obj in make_iter(location):
candidates.extend([o.dbobj for o in obj.contents])
candidates.extend(obj.contents)
else:
# local search. Candidates are self.contents, self.location
# and self.location.contents
@ -434,8 +433,6 @@ class ObjectDB(TypedObject):
else:
# normally we are included in location.contents
candidates.append(self)
# db manager expects database objects
candidates = [obj.dbobj for obj in candidates]
results = ObjectDB.objects.object_search(searchdata,
attribute_name=attribute_name,

View file

@ -268,7 +268,7 @@ class Object(ObjectDB):
if searchdata.lower() in ("me", "self",):
return self
return self.dbobj.search(searchdata,
return super(Object, self).search(searchdata,
global_search=global_search,
use_nicks=use_nicks,
typeclass=typeclass,
@ -305,7 +305,7 @@ class Object(ObjectDB):
# searchdata is a string; wrap some common self-references
if searchdata.lower() in ("me", "self",):
return self.player
return self.dbobj.search_player(searchdata, quiet=quiet)
return super(Object, self).search_player(searchdata, quiet=quiet)
def execute_cmd(self, raw_string, sessid=None, **kwargs):
"""
@ -333,7 +333,7 @@ class Object(ObjectDB):
useful for coders intending to implement some sort of nested
command structure.
"""
return self.dbobj.execute_cmd(raw_string, sessid=sessid, **kwargs)
return super(Object, self).execute_cmd(raw_string, sessid=sessid, **kwargs)
def msg(self, text=None, from_obj=None, sessid=None, **kwargs):
"""
@ -347,7 +347,7 @@ class Object(ObjectDB):
default to self.sessid or from_obj.sessid.
"""
self.dbobj.msg(text=text, from_obj=from_obj, sessid=sessid, **kwargs)
super(Object, self).msg(text=text, from_obj=from_obj, sessid=sessid, **kwargs)
def msg_contents(self, text=None, exclude=None, from_obj=None, **kwargs):
"""
@ -356,7 +356,7 @@ class Object(ObjectDB):
exclude is a list of objects not to send to. See self.msg() for
more info.
"""
self.dbobj.msg_contents(text, exclude=exclude,
super(Object, self).msg_contents(text, exclude=exclude,
from_obj=from_obj, **kwargs)
def move_to(self, destination, quiet=False,
@ -387,7 +387,7 @@ class Object(ObjectDB):
emit_to_obj.
"""
return self.dbobj.move_to(destination, quiet=quiet,
return super(Object, self).move_to(destination, quiet=quiet,
emit_to_obj=emit_to_obj,
use_destination=use_destination)
@ -402,7 +402,7 @@ class Object(ObjectDB):
<old_key>_copy by default.
Returns: Object (copy of this one)
"""
return self.dbobj.copy(new_key=new_key)
return super(Object, self).copy(new_key=new_key)
def delete(self):
"""
@ -415,7 +415,7 @@ class Object(ObjectDB):
were errors during deletion or deletion otherwise
failed.
"""
return self.dbobj.delete()
return super(Object, self).delete()
# methods inherited from the typeclass system
@ -434,7 +434,7 @@ class Object(ObjectDB):
Returns: Boolean
"""
return self.dbobj.is_typeclass(typeclass, exact=exact)
return super(Object, self).is_typeclass(typeclass, exact=exact)
def swap_typeclass(self, new_typeclass, clean_attributes=False, no_default=True):
"""
@ -470,7 +470,7 @@ class Object(ObjectDB):
"""
return self.dbobj.swap_typeclass(new_typeclass,
return super(Object, self).swap_typeclass(new_typeclass,
clean_attributes=clean_attributes, no_default=no_default)
def access(self, accessing_obj, access_type='read', default=False, **kwargs):
@ -483,7 +483,7 @@ class Object(ObjectDB):
default (bool) - what to return if no lock of access_type was found
**kwargs - passed to at_access hook along with result,accessing_obj and access_type
"""
result = self.dbobj.access(accessing_obj, access_type=access_type, default=default)
result = super(Object, self).access(accessing_obj, access_type=access_type, default=default)
self.at_access(result, accessing_obj, access_type, **kwargs)
return result
@ -504,7 +504,7 @@ class Object(ObjectDB):
permission on the object.
(example: 'Builders')
"""
return self.dbobj.check_permstring(permstring)
return super(Object, self).check_permstring(permstring)
def __eq__(self, other):
"""