I've also tried passing this through django.shortcuts.render_to_response, but I get the same error. - Sævar
On Jul 6, 2:41 pm, Sævar Öfjörð <saeva...@gmail.com> wrote: > Hi, I've been using the default template loaders and it works fine. > Now I want to add the cached template loader, but I get an error. > > I'm using a wrapper function to return responses that include the > request in the context, like this: > > # file helpers/helpers.py > from django.template import RequestContext, loader > from django.http import HttpResponse > > def return_response(request, dictionary, template, headers={}): > t = loader.get_template(template) > c = RequestContext(request, dictionary) > res = HttpResponse(t.render(c)) > for h, v in headers.iteritems(): > res[h] = v > return res > > The stacktrace: > > Traceback: > File "/home/django/project/virtualenv/lib/python2.6/site-packages/ > django/core/handlers/base.py" in get_response > 106. response = middleware_method(request, > e) > File "/home/django/project/virtualenv/lib/python2.6/site-packages/ > django/core/handlers/base.py" in get_response > 100. response = callback(request, > *callback_args, **callback_kwargs) > File "/home/django/project/project/views.py" in index > 24. return helpers.return_response(request, d, 'frontpage.html') > File "/home/django/project/project/helpers/helpers.py" in > return_response > 129. t = loader.get_template(template) > File "/home/django/project/virtualenv/lib/python2.6/site-packages/ > django/template/loader.py" in get_template > 157. template, origin = find_template(template_name) > File "/home/django/project/virtualenv/lib/python2.6/site-packages/ > django/template/loader.py" in find_template > 128. loader = find_template_loader(loader_name) > File "/home/django/project/virtualenv/lib/python2.6/site-packages/ > django/template/loader.py" in find_template_loader > 104. func = TemplateLoader(*args) > > Exception Type: TypeError at / > Exception Value: __init__() takes exactly 2 arguments (1 given) > > Is there some different way I should approach the template loading? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.