add utility function to know if an event is now
This commit is contained in:
parent
4af42e845f
commit
ba5e9da460
|
@ -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)
|
||||
|
|
Reference in New Issue