Ticket #17913: requestcontext.diff

File requestcontext.diff, 924 bytes (added by Boris Bobrov, 5 years ago)
  • django/template/context.py

    diff --git a/django/template/context.py b/django/template/context.py
    index bbd38ad..9fd6aaa 100644
    a b  
    11from copy import copy
    22from django.core.exceptions import ImproperlyConfigured
    33from django.utils.importlib import import_module
     4from django.http import HttpRequest
    56# Cache of actual callables.
    67_standard_context_processors = None
    class RequestContext(Context): 
    166167    """
    167168    def __init__(self, request, dict_=None, processors=None, current_app=None,
    168169            use_l10n=None, use_tz=None):
     170        if not isinstance(request, HttpRequest):
     171            raise TypeError('request: must be an HttpRequest instance, '
     172                    'not {0}'.format(repr(request)))
    169173        Context.__init__(self, dict_, current_app=current_app,
    170174                use_l10n=use_l10n, use_tz=use_tz)
    171175        if processors is None:
Back to Top