Ticket #9081: flexible_render_to_response.diff

File flexible_render_to_response.diff, 949 bytes (added by Brent Hagany, 16 years ago)
  • django/shortcuts/__init__.py

     
    1111
    1212def render_to_response(*args, **kwargs):
    1313    """
    14     Returns a HttpResponse whose content is filled with the result of calling
     14    Returns a HttpResponse (or subclass) whose content is filled with the result of calling
    1515    django.template.loader.render_to_string() with the passed arguments.
    1616    """
    17     httpresponse_kwargs = {'mimetype': kwargs.pop('mimetype', None)}
    18     return HttpResponse(loader.render_to_string(*args, **kwargs), **httpresponse_kwargs)
     17    httpresponse_kwargs, response_class = {'mimetype': kwargs.pop('mimetype', None)}, kwargs.pop('response_class', HttpResponse)
     18    return response_class(loader.render_to_string(*args, **kwargs), **httpresponse_kwargs)
    1919
    2020def _get_queryset(klass):
    2121    """
Back to Top