Fixed some spurious bugs.

This commit is contained in:
Griatch 2012-02-29 21:58:08 +01:00
parent 7e146eae11
commit 7818ca077a
2 changed files with 11 additions and 9 deletions

View file

@ -250,14 +250,16 @@ class StateLightSourceOn(Script):
prematurely, this hook will store the current prematurely, this hook will store the current
burntime. burntime.
""" """
# calculate remaining burntime # calculate remaining burntime, if object is not
try: # already deleted (because it burned out)
time_burnt = time.time() - self.db.script_started if self.obj:
except TypeError: try:
# can happen if script_started is not defined time_burnt = time.time() - self.db.script_started
time_burnt = self.interval except TypeError:
burntime = self.interval - time_burnt # can happen if script_started is not defined
self.obj.db.burntime = burntime time_burnt = self.interval
burntime = self.interval - time_burnt
self.obj.db.burntime = burntime
def is_valid(self): def is_valid(self):
"This script is only valid as long as the lightsource burns." "This script is only valid as long as the lightsource burns."

View file

@ -217,7 +217,7 @@ class WebClientSession(session.Session):
Disconnect from server Disconnect from server
""" """
if reason: if reason:
self.lineSend(self.suid, reason) self.client.lineSend(self.suid, reason)
self.client.client_disconnect(self.suid) self.client.client_disconnect(self.suid)
def data_out(self, string='', data=None): def data_out(self, string='', data=None):