def _checkParams(self): RHDisplayCategoryBase._checkParams(self) self.detail = request.args.get("detail", "event") if self.detail not in ("event", "session", "contribution"): raise BadRequest("Invalid detail argument") self.period = request.args.get("period", "day") if self.period not in ("day", "month", "week"): raise BadRequest("Invalid period argument") if "date" in request.args: try: date = datetime.strptime(request.args["date"], "%Y-%m-%d") except ValueError: raise BadRequest("Invalid date argument") else: date = datetime.now() date = self.category.display_tzinfo.localize(date) date = date.replace(hour=0, minute=0, second=0, microsecond=0) if self.period == "day": self.start_dt = date self.end_dt = self.start_dt + relativedelta(days=1) elif self.period == "week": self.start_dt = date - relativedelta(days=date.weekday()) self.end_dt = self.start_dt + relativedelta(days=7) elif self.period == "month": self.start_dt = date + relativedelta(day=1) self.end_dt = self.start_dt + relativedelta(months=1)
def _process_args(self): RHDisplayCategoryBase._process_args(self) self.detail = request.args.get('detail', 'event') if self.detail not in ('event', 'session', 'contribution'): raise BadRequest('Invalid detail argument') self.period = request.args.get('period', 'day') if self.period not in ('day', 'month', 'week'): raise BadRequest('Invalid period argument') if 'date' in request.args: try: date = datetime.strptime(request.args['date'], '%Y-%m-%d') except ValueError: raise BadRequest('Invalid date argument') else: date = datetime.now() date = self.category.display_tzinfo.localize(date) date = date.replace(hour=0, minute=0, second=0, microsecond=0) if self.period == 'day': self.start_dt = date self.end_dt = self.start_dt + relativedelta(days=1) elif self.period == 'week': self.start_dt = date - relativedelta(days=date.weekday()) self.end_dt = self.start_dt + relativedelta(days=7) elif self.period == 'month': self.start_dt = date + relativedelta(day=1) self.end_dt = self.start_dt + relativedelta(months=1)
def _checkParams(self): RHDisplayCategoryBase._checkParams(self) self.detail = request.args.get('detail', 'event') if self.detail not in ('event', 'session', 'contribution'): raise BadRequest('Invalid detail argument') self.period = request.args.get('period', 'day') if self.period not in ('day', 'month', 'week'): raise BadRequest('Invalid period argument') if 'date' in request.args: try: date = datetime.strptime(request.args['date'], '%Y-%m-%d') except ValueError: raise BadRequest('Invalid date argument') else: date = datetime.now() date = self.category.display_tzinfo.localize(date) date = date.replace(hour=0, minute=0, second=0, microsecond=0) if self.period == 'day': self.start_dt = date self.end_dt = self.start_dt + relativedelta(days=1) elif self.period == 'week': self.start_dt = date - relativedelta(days=date.weekday()) self.end_dt = self.start_dt + relativedelta(days=7) elif self.period == 'month': self.start_dt = date + relativedelta(day=1) self.end_dt = self.start_dt + relativedelta(months=1)
def _process_args(self): RHDisplayCategoryBase._process_args(self) tz = self.category.display_tzinfo try: self.start_dt = tz.localize(dateutil.parser.parse(request.args['start'])).astimezone(utc) self.end_dt = tz.localize(dateutil.parser.parse(request.args['end'])).astimezone(utc) except ParserError as e: raise BadRequest(str(e))
def _process_args(self): RHDisplayCategoryBase._process_args(self) DownloadAttachmentMixin._process_args(self)
def _process_args(self): RHDisplayCategoryBase._process_args(self) self.now = now_utc(exact=False).astimezone(self.category.display_tzinfo)
def _checkParams(self): RHDisplayCategoryBase._checkParams(self) self.now = now_utc(exact=False).astimezone(self.category.display_tzinfo)
def _checkParams(self): RHDisplayCategoryBase._checkParams(self) DownloadAttachmentMixin._checkParams(self)
def _process_args(self): RHDisplayCategoryBase._process_args(self) self.now = now_utc(exact=False).astimezone( self.category.display_tzinfo) self.is_flat = request.args.get( 'flat') == '1' and self.category.is_flat_view_enabled