New player registrations are once again working. Shored up some vulnerable spots too.

This commit is contained in:
Greg Taylor 2007-01-04 01:55:01 +00:00
parent 95e645246e
commit 2c85fe3be5
5 changed files with 16 additions and 4 deletions

View file

@ -499,7 +499,8 @@ class Object(models.Model):
quiet: (bool) If true, don't emit left/arrived messages.
"""
if not quiet:
self.get_location().emit_to_contents("%s has left." % (self.get_ansiname(),), exclude=self)
if self.get_location():
self.get_location().emit_to_contents("%s has left." % (self.get_ansiname(),), exclude=self)
self.location = target
self.save()

Binary file not shown.

View file

@ -191,6 +191,14 @@ def create_user(cdat, uname, email, password):
# the next free unique ID to use and make sure the two entries are
# the same number.
uid = get_nextfree_dbnum()
print 'UID', uid
# If this is an object, we know to recycle it since it's garbage. We'll
# pluck the user ID from it.
if not str(uid).isdigit():
uid = uid.id
print 'UID2', uid
user = User.objects.create_user(uname, email, password)
# It stinks to have to do this but it's the only trivial way now.
user.save()

View file

@ -70,8 +70,11 @@ class PlayerSession(async_chat):
"""
Returns the object associated with a session.
"""
result = Object.objects.get(id=self.uid)
return result
try:
result = Object.objects.get(id=self.uid)
return result
except:
return False
def game_connect_screen(self, session):
"""

View file

@ -33,7 +33,7 @@ def session_from_object(targobject):
session_list: (list) The server's session_list attribute.
targobject: (Object) The object to match.
"""
results = [prospect for prospect in session_list if prospect.get_pobject().id == targobject.id]
results = [prospect for prospect in session_list if prospect.get_pobject() == targobject]
if results:
return results[0]
else: