Exemplo n.º 1
0
 def _postprocess(self, context, content):
     for inject_func in get_provide_objects("xtheme_resource_injection"):
         if callable(inject_func):
             inject_func(context, content)
     add_edit_resources(context)
     content = inject_resources(context, content)
     return content
Exemplo n.º 2
0
 def _postprocess(self, context, content):
     for inject_func in get_provide_objects("xtheme_resource_injection"):
         if callable(inject_func):
             inject_func(context, content)
     add_edit_resources(context)
     content = inject_resources(context, content)
     return content
Exemplo n.º 3
0
def test_without_rc():
    request = get_request()
    (template, layout, gibberish, ctx) = get_test_template_bits(request)
    assert not add_resource(ctx, "yes", "hello.js")
    content1 = "<html>"
    content2 = inject_resources(ctx, content1)
    assert content1 == content2
Exemplo n.º 4
0
def test_without_rc():
    request = get_request()
    (template, layout, gibberish, ctx) = get_test_template_bits(request)
    assert not add_resource(ctx, "yes", "hello.js")
    content1 = "<html>"
    content2 = inject_resources(ctx, content1)
    assert content1 == content2
Exemplo n.º 5
0
    def _postprocess(self, context, content):
        # if the context contains the `allow_resource_injection` key and
        # it's value is False, we don't inject resources in the content
        if context and context.get("allow_resource_injection", True) is False:
            return content

        for inject_func in get_provide_objects("xtheme_resource_injection"):
            if callable(inject_func):
                inject_func(context, content)
        add_edit_resources(context)
        content = inject_resources(context, content)
        return content