add utility function to know if an event is now

This commit is contained in:
Frédéric Péters 2011-12-02 16:18:46 +01:00
parent 4af42e845f
commit ba5e9da460
1 changed files with 7 additions and 1 deletions

View File

@ -88,7 +88,13 @@ class BaseEvent(Item):
except IndexError:
return '#'
def is_now(self):
now = datetime.datetime.now()
if now < self.start:
return False
if self.end and now > self.end:
return False
return True
class Event(BaseEvent):
implements(IEvent)