def handle_filter(self, action, data): start_date = data.get("range_start_date") end_date = data.get("range_end_date") params = {} if start_date and end_date: if start_date > end_date: self.status = _("Invalid Date Range") cookies.unset_date_range(self.request) return start, end = self.get_start_end_restictions(self.context) if start_date and end: if start_date > end: self.status = (_("Start date must be before %s") % end.strftime("%d %B %Y")) cookies.unset_date_range(self.request) return if end_date and start: if end_date < start: self.status = (_("End date must be after %s") % start.strftime("%d %B %Y")) cookies.unset_date_range(self.request) return cookies.set_date_range(self.request, start_date, end_date) self.request.response.redirect( "?portal_status_message=%s" % translate( _(u"Date range set")))
def handle_filter(self, action, data): start_date = data.get('range_start_date') end_date = data.get('range_end_date') params = {} if start_date and end_date: if start_date > end_date: self.status = _("Invalid Date Range") unset_date_range(self.request) return start, end = self.get_start_end_restictions(self.context) if start_date and end: if start_date > end: self.status = (_("Start date must be before %s") % end.strftime("%d %B %Y")) unset_date_range(self.request) return if end_date and start: if end_date < start: self.status = (_("End date must be after %s") % start.strftime("%d %B %Y")) unset_date_range(self.request) return set_date_range(self.request, start_date, end_date) self.request.response.redirect( "?portal_status_message=%s" % translate( _(u"Date range set")))
def handle_clear(self, action, data): cookies.unset_date_range(self.request) self.request.response.redirect( "?portal_status_message=%s" % translate( _(u"Date range cleared")))
def handle_clear(self, action, data): unset_date_range(self.request) self.request.response.redirect( "?portal_status_message=%s" % translate( _(u"Date range cleared")))