def _process(self): session_key = "reglist_config_{}".format(self.regform.id) configuration = {"regform_id": self.regform.id, "data": session.get(session_key)} url = url_for(".manage_reglist", self.regform, _external=True) if configuration["data"]: link = ReportLink.create(self.event_new, REPORT_LINK_TYPE, configuration) url = url_for(".manage_reglist", self.regform, config=link.uuid, _external=True) return jsonify(url=url)
def _get_reg_list_config(regform): session_key = "reglist_config_{}".format(regform.id) report_config_uuid = request.args.get("config") if report_config_uuid: configuration = ReportLink.load(regform.event_new, REPORT_LINK_TYPE, report_config_uuid) if configuration and configuration["regform_id"] == regform.id: session[session_key] = configuration["data"] return session.get(session_key, DEFAULT_REPORT_CONFIG)
def _get_reg_list_config(regform): session_key = 'reglist_config_{}'.format(regform.id) report_config_uuid = request.args.get('config') if report_config_uuid: configuration = ReportLink.load(regform.event_new, REPORT_LINK_TYPE, report_config_uuid) if configuration and configuration['regform_id'] == regform.id: session[session_key] = configuration['data'] return session.get(session_key, DEFAULT_REPORT_CONFIG)
def _get_config(self): """Load the report's configuration from the DB and return it.""" session_key = self._get_config_session_key() if self.static_link_used: uuid = request.args['config'] configuration = ReportLink.load(self.report_event, self.report_link_type, uuid) if configuration and configuration['entry_parent_id'] == self.entry_parent.id: session[session_key] = configuration['data'] return session.get(session_key, self.default_report_config)
def _get_config(self): """Load the report's configuration from the DB and return it.""" session_key = self._get_config_session_key() if self.static_link_used: uuid = request.args['config'] configuration = ReportLink.load(self.report_event, self.report_link_type, uuid) if configuration and configuration[ 'entry_parent_id'] == self.entry_parent.id: session[session_key] = configuration['data'] return session.get(session_key, self.default_report_config)
def generate_static_url(self): """Return a URL with a uuid referring to the report's configuration.""" session_key = self._get_config_session_key() configuration = { 'entry_parent_id': self.entry_parent.id, 'data': session.get(session_key) } if configuration['data']: link = ReportLink.create(self.report_event, self.report_link_type, configuration) return self.get_report_url(uuid=link.uuid, external=True) else: return self.get_report_url(external=True)
def _process(self): session_key = 'reglist_config_{}'.format(self.regform.id) configuration = { 'regform_id': self.regform.id, 'data': session.get(session_key) } url = url_for('.manage_reglist', self.regform, _external=True) if configuration['data']: link = ReportLink.create(self.event_new, REPORT_LINK_TYPE, configuration) url = url_for('.manage_reglist', self.regform, config=link.uuid, _external=True) return jsonify(url=url)