Prevent an error in @ps being used before the events have triggered the first time.

This commit is contained in:
Greg Taylor 2009-04-06 17:15:35 +00:00
parent 5a465746c5
commit eb2608ffd2
2 changed files with 8 additions and 7 deletions

View file

@ -24,6 +24,14 @@ class IntervalEvent(object):
# A reference to the task.LoopingCall object.
looped_task = None
def __init__(self):
"""
Executed when the class is instantiated.
"""
# This is set to prevent a Nonetype exception on @ps before the
# event is fired for the first time.
self.time_last_executed = time.time()
def __unicode__(self):
"""
String representation of the event.

View file

@ -9,13 +9,6 @@ ADDING AN EVENT:
# List of IntervalEvent sub-classed objects.
schedule = []
def start_events():
"""
Start the event system, which is built on Twisted's framework.
"""
for event in schedule:
event.start_event_loop()
def add_event(event):
"""