def get_edit(self, request): username = request.getCookie("username") title = request.args.get("title", "") request.args["title"] = title if "delete" in request.args and title != "": user_id = model.ensure_user_exists(self.__SessionMaker, username) model.remove_graph(self.__SessionMaker, user_id, title) request.setResponseCode(303) request.redirect("/") return "" data_sources = model.get_data_sources(self.__SessionMaker) for each_metric in data_sources.itervalues(): each_metric.sort() active_components = [each.split("|")[0] for each in request.args if "|" in each] graph_type = request.args.get("graph_type", "") template = self.__template_lookup.get_template("edit.mako") return template.render( kwargs=request.args, data_sources=data_sources, active_components=active_components, username=username, timescales=self.timescales, graph_types=self.graph_types, ).encode("utf8")
def get_edit(self, request): username = request.getCookie('username') title = request.args.get('title', '') request.args['title'] = title if 'delete' in request.args and title != '': user_id = model.ensure_user_exists(self.__SessionMaker, username) model.remove_graph(self.__SessionMaker, user_id, title) request.setResponseCode(303) request.redirect('/') return '' data_sources = model.get_data_sources(self.__SessionMaker) for each_metric in data_sources.itervalues(): each_metric.sort() active_components = \ [each.split('|')[0] for each in request.args if '|' in each] graph_type = request.args.get('graph_type', '') template = self.__template_lookup.get_template('edit.mako') return template.render(kwargs=request.args, data_sources=data_sources, active_components=active_components, username=username, timescales=self.timescales, graph_types=self.graph_types).encode('utf8')
def get_edit(self, request): user_session = request.getSession() username = self.__user_sessions.get(user_session) title = request.args.get('title', '') request.args['title'] = title if 'delete' in request.args and title != '': user_id = model.ensure_user_exists(self.__SessionMaker, username) model.remove_graph(self.__SessionMaker, user_id, title) request.setResponseCode(303) request.redirect('/') request.finish() return graph_type = request.args.get('graph_type', '') data_sources = model.get_data_sources(self.__SessionMaker) for each_metric in data_sources.itervalues(): each_metric.sort() template = self.__template_lookup.get_template('edit.mako') return template.render(kwargs=request.args, data_sources=data_sources, username=username, timescales=self.timescales, graph_types=self.graph_types)