def getApplicableEventsTypesAt(self, obj, date, allEventTypes, preComputed, forBrowser=False): '''Returns the event types that are applicable at a given p_date. More precisely, it returns an object with 2 attributes: * "events" is the list of applicable event types; * "message", not empty if some event types are not applicable, contains a message explaining those event types are not applicable. ''' if not self.applicableEvents: eventTypes = allEventTypes message = None else: eventTypes = allEventTypes[:] message = self.applicableEvents(obj.appy(), date, eventTypes, preComputed) res = Object(eventTypes=eventTypes, message=message) if forBrowser: res.eventTypes = ','.join(res.eventTypes) if not res.message: res.message = '' else: res.message = obj.formatText(res.message, format='js') return res.__dict__ return res
def getApplicableEventsTypesAt(self, obj, date, allEventTypes, preComputed, forBrowser=False): '''Returns the event types that are applicable at a given p_date. More precisely, it returns an object with 2 attributes: * "events" is the list of applicable event types; * "message", not empty if some event types are not applicable, contains a message explaining those event types are not applicable. ''' if not self.applicableEvents: eventTypes = allEventTypes message = None else: eventTypes = allEventTypes[:] message = self.applicableEvents(obj.appy(), date, eventTypes, preComputed) res = Object(eventTypes=eventTypes, message=message) if forBrowser: res.eventTypes = ','.join(res.eventTypes) if not res.message: res.message = '' return res