Exemple #1
0
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
Exemple #2
0
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
Exemple #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
Exemple #4
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