def content(self): # type: () -> Text actions_for_template = [] for category in actions.actions().keys(): available_actions = actions.for_category(category) for action in available_actions: d = { "category": action.category, "title": action.title, "class": action.__class__.__name__, } try: d["endpoint"] = text_type(action.endpoint) except BaseException: d["endpoint"] = "<Exception>" try: d["url"] = text_type(action.url(g.action_context)) except BaseException: d["url"] = "<Exception>" actions_for_template.append(d) actions_for_template.sort(key=lambda x: (x["category"], x["title"])) ctx = {"actions": actions_for_template} jinja_env = current_app.jinja_env jinja_env.filters.update(self.jinja_env.filters) template = jinja_env.get_or_select_template("debug_panels/actions_panel.html") return template.render(ctx)
def content(self): actions_for_template = [] for category in actions.actions().keys(): available_actions = actions.for_category(category) for action in available_actions: d = { 'category': action.category, 'title': action.title, 'class': action.__class__.__name__, } try: d['endpoint'] = text_type(action.endpoint) except: d['endpoint'] = '<Exception>' try: d['url'] = text_type(action.url(g.action_context)) except: d['url'] = '<Exception>' actions_for_template.append(d) actions_for_template.sort(key=lambda x: (x['category'], x['title'])) ctx = {'actions': actions_for_template} jinja_env = current_app.jinja_env jinja_env.filters.update(self.jinja_env.filters) template = jinja_env.get_or_select_template( 'debug_panels/actions_panel.html') return template.render(ctx)
def content(self): # type: () -> Text actions_for_template = [] for category in actions.actions().keys(): available_actions = actions.for_category(category) for action in available_actions: d = { "category": action.category, "title": action.title, "class": action.__class__.__name__, } try: d["endpoint"] = str(action.endpoint) except Exception: d["endpoint"] = "<Exception>" try: d["url"] = str(action.url(g.action_context)) except Exception: d["url"] = "<Exception>" actions_for_template.append(d) actions_for_template.sort(key=lambda x: (x["category"], x["title"])) ctx = {"actions": actions_for_template} jinja_env = current_app.jinja_env jinja_env.filters.update(self.jinja_env.filters) template = jinja_env.get_or_select_template("debug_panels/actions_panel.html") return template.render(ctx)
def test_actions(app_context): setup_actions(app_context.app) all_actions = actions.actions() assert "cat_1" in all_actions assert "cat_2:sub" in all_actions assert all_actions["cat_1"] == [BASIC, CONDITIONAL] assert all_actions["cat_2:sub"] == [OTHER_CAT]
def test_actions(app_context: AppContext) -> None: setup_actions(app_context.app) all_actions = actions.actions() assert "cat_1" in all_actions assert "cat_2:sub" in all_actions assert all_actions["cat_1"] == [BASIC, CONDITIONAL] assert all_actions["cat_2:sub"] == [OTHER_CAT]
def test_actions(self): all_actions = actions.actions() assert 'cat_1' in all_actions assert 'cat_2:sub' in all_actions assert all_actions['cat_1'] == [BASIC, CONDITIONAL] assert all_actions['cat_2:sub'] == [OTHER_CAT]