Fixed some issues with @dest'ing player objects that don't have a matching account (should never really happen but just in case.)

This commit is contained in:
Greg Taylor 2007-01-04 01:36:22 +00:00
parent cf0fa701ef
commit 95e645246e
4 changed files with 18 additions and 6 deletions

View file

@ -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

Binary file not shown.

View file

@ -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.

View file

@ -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