> It's a very good idea, but it suffers from a DRY usability concern
> related to the pervasive use of the render_to_response() shortcut
> commonly employed by Django apps.  Because render_to_response() is a
> static method, there's no good way to pre-configure it to use
> RequestContext instead of Context, which means that you must ensure
> that you must set context_instance in EVERY use of render_to_response
> in your view.  eg. render_to_response(...,
> initial_context=RequestContext(request)). If you ever forget this one
> detail, you might end up with a funny looking page.

I'll have to disagree with you here.  I think this is a perfect
example of Russ's point.  Somewhere on your PYTHONPATH just write a
function that looks something like this (warning, untested code):

from django.shortcuts import render_to_response as old_rtr
from django.template import RequestContext
def render_response(request, *args, **kwargs):
    kwargs['context_instance'] = RequestContext(request)
    return old_rtr(*args, **kwargs)

Now all you have to is import your new render_response method and use
that instead of the default render_to_response.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to