示例#1
0
文件: display.py 项目: indico/indico
 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)
示例#2
0
 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)
示例#3
0
文件: display.py 项目: OmeGak/indico
 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)
示例#4
0
 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))
示例#5
0
 def _process_args(self):
     RHDisplayCategoryBase._process_args(self)
     DownloadAttachmentMixin._process_args(self)
示例#6
0
 def _process_args(self):
     RHDisplayCategoryBase._process_args(self)
     self.now = now_utc(exact=False).astimezone(self.category.display_tzinfo)
示例#7
0
 def _checkParams(self):
     RHDisplayCategoryBase._checkParams(self)
     self.now = now_utc(exact=False).astimezone(self.category.display_tzinfo)
示例#8
0
 def _checkParams(self):
     RHDisplayCategoryBase._checkParams(self)
     DownloadAttachmentMixin._checkParams(self)
示例#9
0
 def _process_args(self):
     RHDisplayCategoryBase._process_args(self)
     DownloadAttachmentMixin._process_args(self)
示例#10
0
 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
示例#11
0
 def _process_args(self):
     RHDisplayCategoryBase._process_args(self)
     self.now = now_utc(exact=False).astimezone(self.category.display_tzinfo)
示例#12
0
文件: category.py 项目: OmeGak/indico
 def _checkParams(self):
     RHDisplayCategoryBase._checkParams(self)
     DownloadAttachmentMixin._checkParams(self)