Ticket #5682: patch_django_5682_http.diff

File patch_django_5682_http.diff, 2.2 KB (added by David Larlet, 17 years ago)

Patch against django.http.init.py

  • django_src/django/http/__init__.py

     
    2020class HttpRequest(object):
    2121    "A basic HTTP request"
    2222
    23     # The encoding used in GET/POST dicts. None means use default setting.
     23    # The encoding used in GET/POST/PUT dicts. None means use default setting.
    2424    _encoding = None
    2525
    2626    def __init__(self):
    27         self.GET, self.POST, self.COOKIES, self.META, self.FILES = {}, {}, {}, {}, {}
     27        self.GET, self.POST, self.PUT, self.COOKIES, self.META, self.FILES = {}, {}, {}, {}, {}, {}
    2828        self.path = ''
    2929        self.method = None
    3030
    3131    def __repr__(self):
    32         return '<HttpRequest\nGET:%s,\nPOST:%s,\nCOOKIES:%s,\nMETA:%s>' % \
    33             (pformat(self.GET), pformat(self.POST), pformat(self.COOKIES),
    34             pformat(self.META))
     32        return '<HttpRequest\nGET:%s,\nPOST:%s,\nPUT:%s,\nCOOKIES:%s,\nMETA:%s>' % \
     33            (pformat(self.GET), pformat(self.POST), pformat(self.PUT),
     34            pformat(self.COOKIES), pformat(self.META))
    3535
    3636    def __getitem__(self, key):
    37         for d in (self.POST, self.GET):
     37        for d in (self.POST, self.GET, self.PUT):
    3838            if key in d:
    3939                return d[key]
    40         raise KeyError, "%s not found in either POST or GET" % key
     40        raise KeyError, "%s not found in either POST, GET or PUT" % key
    4141
    4242    def has_key(self, key):
    43         return key in self.GET or key in self.POST
     43        return key in self.GET or key in self.POST or key in self.PUT
    4444
    4545    __contains__ = has_key
    4646
     
    8181
    8282    def _set_encoding(self, val):
    8383        """
    84         Sets the encoding used for GET/POST accesses. If the GET or POST
     84        Sets the encoding used for GET/POST/PUT accesses. If the GET, POST or PUT
    8585        dictionary has already been created, it is removed and recreated on the
    8686        next access (so that it is decoded correctly).
    8787        """
     
    9090            del self._get
    9191        if hasattr(self, '_post'):
    9292            del self._post
     93        if hasattr(self, '_put'):
     94            del self._put
    9395
    9496    def _get_encoding(self):
    9597        return self._encoding
Back to Top