diff --git a/evennia/trunk/apps/objects/models.py b/evennia/trunk/apps/objects/models.py index 08387754ac..573df86539 100755 --- a/evennia/trunk/apps/objects/models.py +++ b/evennia/trunk/apps/objects/models.py @@ -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() diff --git a/evennia/trunk/evennia.sql b/evennia/trunk/evennia.sql index 447a92386a..e660cc1513 100755 Binary files a/evennia/trunk/evennia.sql and b/evennia/trunk/evennia.sql differ diff --git a/evennia/trunk/functions_db.py b/evennia/trunk/functions_db.py index bd1763fb4b..91ca3179d0 100644 --- a/evennia/trunk/functions_db.py +++ b/evennia/trunk/functions_db.py @@ -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() diff --git a/evennia/trunk/session.py b/evennia/trunk/session.py index dd10b650d3..58c75fbbb3 100755 --- a/evennia/trunk/session.py +++ b/evennia/trunk/session.py @@ -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): """ diff --git a/evennia/trunk/session_mgr.py b/evennia/trunk/session_mgr.py index ed2e19cee4..93b44736d1 100644 --- a/evennia/trunk/session_mgr.py +++ b/evennia/trunk/session_mgr.py @@ -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: