diff --git a/chat/indico_chat/controllers/logs.py b/chat/indico_chat/controllers/logs.py index b50b658..9764f79 100644 --- a/chat/indico_chat/controllers/logs.py +++ b/chat/indico_chat/controllers/logs.py @@ -39,8 +39,8 @@ from indico_chat.xmpp import retrieve_logs class RHChatManageEventLogs(RHEventChatroomMixin, RHChatManageEventBase): """UI to retrieve logs for a chatroom""" - def _process_args(self, params): - RHChatManageEventBase._process_args(self, params) + def _process_args(self): + RHChatManageEventBase._process_args(self) RHEventChatroomMixin._process_args(self) def _process(self): @@ -56,8 +56,8 @@ class RHChatManageEventLogs(RHEventChatroomMixin, RHChatManageEventBase): class RHChatManageEventRetrieveLogsBase(RHEventChatroomMixin, RHChatManageEventBase): """Retrieves logs for a chatroom""" - def _process_args(self, params): - RHChatManageEventBase._process_args(self, params) + def _process_args(self): + RHChatManageEventBase._process_args(self) RHEventChatroomMixin._process_args(self) if 'get_all_logs' not in request.values: @@ -89,8 +89,8 @@ class RHChatManageEventShowLogs(RHChatManageEventRetrieveLogsBase): class RHChatManageEventAttachLogs(RHChatManageEventRetrieveLogsBase): """Attachs the logs for a chatroom to the event""" - def _process_args(self, params): - RHChatManageEventRetrieveLogsBase._process_args(self, params) + def _process_args(self): + RHChatManageEventRetrieveLogsBase._process_args(self) self.material_name = request.form['material_name'].strip() self.file_repo_id = None diff --git a/chat/indico_chat/controllers/management.py b/chat/indico_chat/controllers/management.py index 57cd116..e366550 100644 --- a/chat/indico_chat/controllers/management.py +++ b/chat/indico_chat/controllers/management.py @@ -66,8 +66,8 @@ class RHChatManageEvent(AttachChatroomMixin, RHChatManageEventBase): class RHChatManageEventModify(RHEventChatroomMixin, RHChatManageEventBase): """Modifies an existing chatroom""" - def _process_args(self, params): - RHChatManageEventBase._process_args(self, params) + def _process_args(self): + RHChatManageEventBase._process_args(self) RHEventChatroomMixin._process_args(self) def _process(self): @@ -93,8 +93,8 @@ class RHChatManageEventModify(RHEventChatroomMixin, RHChatManageEventBase): class RHChatManageEventRefresh(RHEventChatroomMixin, RHChatManageEventBase): """Synchronizes the local chatroom data with the XMPP server""" - def _process_args(self, params): - RHChatManageEventBase._process_args(self, params) + def _process_args(self): + RHChatManageEventBase._process_args(self) RHEventChatroomMixin._process_args(self) def _process(self): @@ -146,8 +146,8 @@ class RHChatManageEventCreate(RHChatManageEventBase): class RHChatManageEventAttach(AttachChatroomMixin, RHChatManageEventBase): """Attaches an existing chatroom to an event""" - def _process_args(self, params): - RHChatManageEventBase._process_args(self, params) + def _process_args(self): + RHChatManageEventBase._process_args(self) def _process(self): form = self._get_attach_form() @@ -163,8 +163,8 @@ class RHChatManageEventAttach(AttachChatroomMixin, RHChatManageEventBase): class RHChatManageEventRemove(RHEventChatroomMixin, RHChatManageEventBase): """Removes a chatroom from an event (and if necessary from the server)""" - def _process_args(self, params): - RHChatManageEventBase._process_args(self, params) + def _process_args(self): + RHChatManageEventBase._process_args(self) RHEventChatroomMixin._process_args(self) def _process(self): diff --git a/importer/indico_importer/controllers.py b/importer/indico_importer/controllers.py index 445ddfd..411b4b7 100644 --- a/importer/indico_importer/controllers.py +++ b/importer/indico_importer/controllers.py @@ -18,11 +18,9 @@ from __future__ import unicode_literals from datetime import datetime -from dateutil.relativedelta import relativedelta from flask import jsonify, request from flask_pluginengine import current_plugin from pytz import timezone, utc -from werkzeug.exceptions import NotFound from indico.core.db import db from indico.legacy.webinterface.rh.base import RHProtected @@ -72,8 +70,8 @@ class RHEndTimeBase(RHManageTimetableBase): class RHDayEndTime(RHEndTimeBase): """Get the end_dt of the latest timetable entry or the event start_dt if no entry exist on that date""" - def _process_args(self, params): - RHEndTimeBase._process_args(self, params) + def _process_args(self): + RHEndTimeBase._process_args(self) self.date = self.event.tzinfo.localize(datetime.strptime(request.args['selectedDay'], '%Y/%m/%d')).date() def _process(self): @@ -98,12 +96,13 @@ class RHBlockEndTime(RHEndTimeBase): } } - def _process_args(self, params): - RHEndTimeBase._process_args(self, params) - self.date = timezone(self.event.timezone).localize(datetime.strptime(request.args['selectedDay'], - '%Y/%m/%d')) - self.timetable_entry = self.event.timetable_entries.filter_by( - type=TimetableEntryType.SESSION_BLOCK, id=request.view_args['entry_id']).first_or_404() + def _process_args(self): + RHEndTimeBase._process_args(self) + self.date = timezone(self.event.timezone).localize(datetime.strptime(request.args['selectedDay'], '%Y/%m/%d')) + self.timetable_entry = (self.event.timetable_entries + .filter_by(type=TimetableEntryType.SESSION_BLOCK, + id=request.view_args['entry_id']) + .first_or_404()) def _process(self): entries = self.timetable_entry.children diff --git a/piwik/indico_piwik/controllers.py b/piwik/indico_piwik/controllers.py index d6b303a..abc5620 100644 --- a/piwik/indico_piwik/controllers.py +++ b/piwik/indico_piwik/controllers.py @@ -14,9 +14,8 @@ # You should have received a copy of the GNU General Public License # along with Indico; if not, see . -from flask import jsonify +from flask import jsonify, request -from indico.core.config import config from indico.modules.events.management.controllers import RHManageEventBase from indico_piwik.reports import (ReportCountries, ReportDevices, ReportDownloads, ReportGeneral, ReportMaterial, @@ -25,37 +24,34 @@ from indico_piwik.views import WPStatistics class RHStatistics(RHManageEventBase): - def _process_args(self, params): - RHManageEventBase._process_args(self, params) - self._params = params - self._params['loading_gif'] = '{}/images/loading.gif'.format(config.BASE_URL) - self._params['report'] = ReportGeneral.get(event_id=params.get('confId'), contrib_id=params.get('contrib_id'), - start_date=params.get('start_date'), end_date=params.get('end_date')) - def _process(self): - return WPStatistics.render_template('statistics.html', self._conf, **self._params) + report = ReportGeneral.get(event_id=self.event.id, + contrib_id=request.args.get('contrib_id'), + start_date=request.args.get('start_date'), + end_date=request.args.get('end_date')) + return WPStatistics.render_template('statistics.html', self._conf, report=report) class RHApiBase(RHManageEventBase): ALLOW_LOCKED = True - def _process_args(self, params): - RHManageEventBase._process_args(self, params) - self._report_params = {'start_date': params.get('start_date'), - 'end_date': params.get('end_date')} + def _process_args(self): + RHManageEventBase._process_args(self) + self._report_params = {'start_date': request.args.get('start_date'), + 'end_date': request.args.get('end_date')} class RHApiEventBase(RHApiBase): - def _process_args(self, params): - RHApiBase._process_args(self, params) - self._report_params['event_id'] = params['confId'] - self._report_params['contrib_id'] = params.get('contrib_id') + def _process_args(self): + RHApiBase._process_args(self) + self._report_params['event_id'] = self.event.id + self._report_params['contrib_id'] = request.args.get('contrib_id') class RHApiDownloads(RHApiEventBase): - def _process_args(self, params): - RHApiEventBase._process_args(self, params) - self._report_params['download_url'] = params['download_url'] + def _process_args(self): + RHApiEventBase._process_args(self) + self._report_params['download_url'] = request.args['download_url'] def _process(self): return jsonify(ReportDownloads.get(**self._report_params)) diff --git a/piwik/indico_piwik/templates/statistics.html b/piwik/indico_piwik/templates/statistics.html index 4a0a3e9..1bdcde5 100644 --- a/piwik/indico_piwik/templates/statistics.html +++ b/piwik/indico_piwik/templates/statistics.html @@ -134,7 +134,7 @@ {% trans %}Visitors Geography{% endtrans %}
- {% trans %}Visitor Origins{% endtrans %}
@@ -177,7 +177,7 @@ {% trans %}User Systems{% endtrans %}
- {% trans %}Visitor Systems{% endtrans %}
diff --git a/previewer_jupyter/indico_previewer_jupyter/controllers.py b/previewer_jupyter/indico_previewer_jupyter/controllers.py index ce14db5..7c7fa82 100644 --- a/previewer_jupyter/indico_previewer_jupyter/controllers.py +++ b/previewer_jupyter/indico_previewer_jupyter/controllers.py @@ -30,12 +30,10 @@ from indico_previewer_jupyter.cpp_highlighter import CppHighlighter class RHEventPreviewIPyNB(RH): def _check_access(self): - RH._check_access(self) if not self.attachment.can_access(session.user): raise Forbidden - def _process_args(self, params): - RH._process_args(self, params) + def _process_args(self): self.attachment = Attachment.find_one(id=request.view_args['attachment_id'], is_deleted=False) def _process(self):