Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Okay, this isn't an answer, this is a continuation of the above comments, but I need room to post code :)

Here's my code, at the end of loaders.py:

def render_text(text, data, request):
    env = SkinEnvironment(extensions=['jinja2.ext.i18n'])
    template = env.from_string(text) 
    context = RequestContext(request, data)
    return shortcuts.render_to_string(template, data, context)

It works just like if I was using the django Template:

def render_text(text, data, request):
        context = RequestContext(request, data)
        template = Template(text)
        return template.render(context)

that is to say, it imports settings fine, but still doesn't allow for {% trans %} tags.

Okay, this isn't an answer, this is a continuation of the above comments, but I need room to post code :)

Here's my code, at the end of loaders.py:

def render_text(text, data, request): env = SkinEnvironment(extensions=['jinja2.ext.i18n']) Environment(extensions=['jinja2.ext.i18n']) template = env.from_string(text) env.from_string(text) context = RequestContext(request, data) return shortcuts.render_to_string(template, data, context)

context)

It works just like if I was using the django Template:and it returns an error:

def render_text(text, data, request):
        context = RequestContext(request, data)
        template = Template(text)
        return template.render(context)
dictionary update sequence element #0 has length 1; 2 is required

that is to say, it imports settings fine, but still doesn't allow for {% trans %} tags.

Okay, this isn't an answer, this is a continuation of the above comments, but I need room to post code :)

Here's my code, at the end of loaders.py:

def render_text(text, data, request):
    env = Environment(extensions=['jinja2.ext.i18n'])
    template = env.from_string(text)
    context = RequestContext(request, data)
    return shortcuts.render_to_string(template, context)

context)

and it returns an error:

dictionary update sequence element #0 has length 1; 2 is required