def editorToTree(self, parent): super(Timestamp, self).editorToTree(parent) dt = self.Value if dt is None: value = "" else: value = TimeUtils.toDatetime(self.Value).strftime(Formatting.priyomdate) self.input.set(u"value", value)
def getIsOnAir(self): now = datetime.datetime.utcnow() start = TimeUtils.toDatetime(self.BroadcastStart) if now > start: if self.BroadcastEnd is None: return True else: end = datetime.datetime.fromtimestamp(self.BroadcastEnd) return now < end else: return False