コード例 #1
0
    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)
コード例 #2
0
    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)
コード例 #3
0
ファイル: debug_toolbar.py プロジェクト: abilian/abilian-core
    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)
コード例 #4
0
ファイル: test_actions.py プロジェクト: abilian/abilian-core
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]
コード例 #5
0
ファイル: test_actions.py プロジェクト: tmarwen/abilian-core
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]
コード例 #6
0
ファイル: test_actions.py プロジェクト: debon/abilian-core
 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]
コード例 #7
0
ファイル: test_actions.py プロジェクト: debon/abilian-core
 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]