Skip to content

Commit

Permalink
Pass dict to context in render_to_string
Browse files Browse the repository at this point in the history
  • Loading branch information
seocam committed Oct 31, 2016
1 parent 7fb3d82 commit bcc8c9c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
7 changes: 3 additions & 4 deletions revproxy/transformer.py
Expand Up @@ -6,7 +6,7 @@
import logging

from django.utils.six import string_types
from django.template import loader, RequestContext
from django.template import loader

try:
from diazo.compiler import compile_theme
Expand Down Expand Up @@ -127,9 +127,8 @@ def transform(self, rules, theme_template, is_html5, context_data=None):
self.log.info("Don't need to be transformed")
return self.response

context_instance = RequestContext(self.request, context_data)
theme = loader.render_to_string(theme_template,
context_instance=context_instance)
theme = loader.render_to_string(theme_template, context=context_data,
request=self.request)
output_xslt = compile_theme(
rules=rules,
theme=StringIO(theme),
Expand Down
8 changes: 8 additions & 0 deletions tests/settings.py
Expand Up @@ -36,6 +36,14 @@
os.path.join(BASE_DIR, 'templates'),
)

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'APP_DIRS': True,
'DIRS': TEMPLATE_DIRS,
},
]

LOGGING = {
'version': 1,

Expand Down

0 comments on commit bcc8c9c

Please sign in to comment.