diff --git a/evennia/trunk/apps/objects/models.py b/evennia/trunk/apps/objects/models.py index 3ede270ae4..08387754ac 100755 --- a/evennia/trunk/apps/objects/models.py +++ b/evennia/trunk/apps/objects/models.py @@ -270,7 +270,7 @@ class Object(models.Model): """ Clears all of an object's attributes. """ - self.get_all_attributes() + attribs = self.get_all_attributes() for attrib in attribs: self.delete() @@ -289,10 +289,13 @@ class Object(models.Model): # If the object is a player, set the player account object to inactive. # It can still be recovered at this point. if self.is_player(): - uobj = User.objects.get(id=self.id) - uobj.is_active = False - uobj.save() - + try: + uobj = User.objects.get(id=self.id) + uobj.is_active = False + uobj.save() + except: + functions_general.print_errmsg('Destroying object %s but no matching player.' % (self,)) + # Set the object type to GOING self.type = 5 self.save() @@ -600,4 +603,5 @@ class Object(models.Model): return global_defines.OBJECT_TYPES[otype][1][0] import functions_db +import functions_general import session_mgr diff --git a/evennia/trunk/evennia.sql b/evennia/trunk/evennia.sql index 63a84031cc..447a92386a 100755 Binary files a/evennia/trunk/evennia.sql and b/evennia/trunk/evennia.sql differ diff --git a/evennia/trunk/functions_general.py b/evennia/trunk/functions_general.py index 7094b1b938..25d7a2cdaa 100644 --- a/evennia/trunk/functions_general.py +++ b/evennia/trunk/functions_general.py @@ -5,6 +5,13 @@ import commands_unloggedin """ General commonly used functions. """ +def print_errmsg(errormsg): + """ + Prints/logs an error message. Pipe any errors to be logged through here. + For now we're just printing to standard out. + """ + print 'ERROR: %s' % (errormsg,) + def command_list(): """ Return a list of all commands. diff --git a/evennia/trunk/prepenv.sh b/evennia/trunk/prepenv.sh index b4030fa174..a5a0fecacf 100755 --- a/evennia/trunk/prepenv.sh +++ b/evennia/trunk/prepenv.sh @@ -1,3 +1,4 @@ #!/bin/bash export DJANGO_SETTINGS_MODULE="settings" -python2.5 -m cProfile -o profiler.log -s time server.py +#python2.5 -m cProfile -o profiler.log -s time server.py +python2.5 server.py