From 7818ca077af216056bd268b9d329cc3c0e7a403c Mon Sep 17 00:00:00 2001 From: Griatch Date: Wed, 29 Feb 2012 21:58:08 +0100 Subject: [PATCH] Fixed some spurious bugs. --- contrib/tutorial_world/objects.py | 18 ++++++++++-------- src/server/webclient.py | 2 +- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/contrib/tutorial_world/objects.py b/contrib/tutorial_world/objects.py index c43912f622..78f39acc04 100644 --- a/contrib/tutorial_world/objects.py +++ b/contrib/tutorial_world/objects.py @@ -250,14 +250,16 @@ class StateLightSourceOn(Script): prematurely, this hook will store the current burntime. """ - # calculate remaining burntime - try: - time_burnt = time.time() - self.db.script_started - except TypeError: - # can happen if script_started is not defined - time_burnt = self.interval - burntime = self.interval - time_burnt - self.obj.db.burntime = burntime + # calculate remaining burntime, if object is not + # already deleted (because it burned out) + if self.obj: + try: + time_burnt = time.time() - self.db.script_started + except TypeError: + # can happen if script_started is not defined + time_burnt = self.interval + burntime = self.interval - time_burnt + self.obj.db.burntime = burntime def is_valid(self): "This script is only valid as long as the lightsource burns." diff --git a/src/server/webclient.py b/src/server/webclient.py index aceedba55d..c4154bb1d2 100644 --- a/src/server/webclient.py +++ b/src/server/webclient.py @@ -217,7 +217,7 @@ class WebClientSession(session.Session): Disconnect from server """ if reason: - self.lineSend(self.suid, reason) + self.client.lineSend(self.suid, reason) self.client.client_disconnect(self.suid) def data_out(self, string='', data=None):