Trap some more odd errors to assist in my tracking down their origin.
This commit is contained in:
parent
51edc17d59
commit
71a76cd1fb
3 changed files with 19 additions and 3 deletions
|
|
@ -160,7 +160,14 @@ def match_exits(command):
|
||||||
"""
|
"""
|
||||||
# If we're not logged in, don't check exits.
|
# If we're not logged in, don't check exits.
|
||||||
source_object = command.source_object
|
source_object = command.source_object
|
||||||
exits = source_object.get_location().get_contents(filter_type=defines_global.OTYPE_EXIT)
|
location = source_object.get_location()
|
||||||
|
|
||||||
|
if location == None:
|
||||||
|
logger.log_errmsg("cmdhandler.match_exits(): Object '%s' no location." %
|
||||||
|
source_object)
|
||||||
|
return
|
||||||
|
|
||||||
|
exits = location.get_contents(filter_type=defines_global.OTYPE_EXIT)
|
||||||
Object = ContentType.objects.get(app_label="objects",
|
Object = ContentType.objects.get(app_label="objects",
|
||||||
model="object").model_class()
|
model="object").model_class()
|
||||||
exit_matches = Object.objects.list_search_object_namestr(exits,
|
exit_matches = Object.objects.list_search_object_namestr(exits,
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ from src import scripthandler
|
||||||
from src import defines_global
|
from src import defines_global
|
||||||
from src import ansi
|
from src import ansi
|
||||||
from src import session_mgr
|
from src import session_mgr
|
||||||
|
from src import logger
|
||||||
# Import as the absolute path to avoid local variable clashes.
|
# Import as the absolute path to avoid local variable clashes.
|
||||||
import src.flags
|
import src.flags
|
||||||
from src.util import functions_general
|
from src.util import functions_general
|
||||||
|
|
@ -225,7 +226,11 @@ class Object(models.Model):
|
||||||
"""
|
"""
|
||||||
Returns the player object's account object (User object).
|
Returns the player object's account object (User object).
|
||||||
"""
|
"""
|
||||||
return User.objects.get(id=self.id)
|
try:
|
||||||
|
return User.objects.get(id=self.id)
|
||||||
|
except User.DoesNotExist:
|
||||||
|
logger.log_errmsg("No account match for object id: %s" % self.id)
|
||||||
|
return None
|
||||||
|
|
||||||
def is_staff(self):
|
def is_staff(self):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,11 @@ class SessionProtocol(StatefulTelnetProtocol):
|
||||||
pobject = self.get_pobject()
|
pobject = self.get_pobject()
|
||||||
if pobject:
|
if pobject:
|
||||||
pobject.set_flag("CONNECTED", False)
|
pobject.set_flag("CONNECTED", False)
|
||||||
pobject.get_location().emit_to_contents("%s has disconnected." % (pobject.get_name(show_dbref=False),), exclude=pobject)
|
|
||||||
|
location = pobject.get_location()
|
||||||
|
if location != None:
|
||||||
|
location.emit_to_contents("%s has disconnected." % (pobject.get_name(show_dbref=False),), exclude=pobject)
|
||||||
|
|
||||||
uaccount = pobject.get_user_account()
|
uaccount = pobject.get_user_account()
|
||||||
uaccount.last_login = datetime.now()
|
uaccount.last_login = datetime.now()
|
||||||
uaccount.save()
|
uaccount.save()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue