コード例 #1
0
ファイル: test_layout.py プロジェクト: Bobby00/boss_shuup
def test_view_config_caches_into_context(rf):
    # This is a silly test...
    request = get_request(edit=False)
    with override_current_theme_class(None):
        (template, layout, gibberish, ctx) = get_test_template_bits(request)
        cfg1 = get_view_config(ctx)
        cfg2 = get_view_config(ctx)
        assert cfg1 is cfg2
        (template, layout, gibberish, ctx) = get_test_template_bits(request, False)
        cfg1 = get_view_config(ctx)
        cfg2 = get_view_config(ctx)
        assert cfg1 is cfg2
コード例 #2
0
ファイル: test_layout.py プロジェクト: ruqaiya/shuup
def test_view_config_caches_into_context(rf):
    # This is a silly test...
    request = get_request(edit=False)
    with override_current_theme_class(None):
        (template, layout, gibberish, ctx) = get_test_template_bits(request)
        cfg1 = get_view_config(ctx)
        cfg2 = get_view_config(ctx)
        assert cfg1 is cfg2
        (template, layout, gibberish, ctx) = get_test_template_bits(request, False)
        cfg1 = get_view_config(ctx)
        cfg2 = get_view_config(ctx)
        assert cfg1 is cfg2
コード例 #3
0
    def get_view_name(self, context):
        """
        Get the current view's view name (used for identifying view configurations).

        :param context: Implicit Jinja2 context
        :type context: jinja2.runtime.Context
        :return: View name string
        :rtype: str
        """
        return get_view_config(context).view_name
コード例 #4
0
ファイル: template_ns.py プロジェクト: ruqaiya/shuup
    def get_view_name(self, context):
        """
        Get the current view's view name (used for identifying view configurations).

        :param context: Implicit Jinja2 context
        :type context: jinja2.runtime.Context
        :return: View name string
        :rtype: str
        """
        return get_view_config(context).view_name