Loading django/core/handlers/wsgi.py +10 −19 Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ from django.core.handlers import base from django.core.urlresolvers import set_script_prefix from django.utils import datastructures from django.utils.encoding import force_str, force_text from django.utils.functional import cached_property from django.utils import six # For backwards compatibility -- lots of code uses this in the wild! Loading Loading @@ -136,15 +137,11 @@ class WSGIRequest(http.HttpRequest): self._request = datastructures.MergeDict(self.POST, self.GET) return self._request def _get_get(self): if not hasattr(self, '_get'): @cached_property def GET(self): # The WSGI spec says 'QUERY_STRING' may be absent. raw_query_string = get_bytes_from_wsgi(self.environ, 'QUERY_STRING', '') self._get = http.QueryDict(raw_query_string, encoding=self._encoding) return self._get def _set_get(self, get): self._get = get return http.QueryDict(raw_query_string, encoding=self._encoding) def _get_post(self): if not hasattr(self, '_post'): Loading @@ -154,23 +151,17 @@ class WSGIRequest(http.HttpRequest): def _set_post(self, post): self._post = post def _get_cookies(self): if not hasattr(self, '_cookies'): @cached_property def COOKIES(self): raw_cookie = get_str_from_wsgi(self.environ, 'HTTP_COOKIE', '') self._cookies = http.parse_cookie(raw_cookie) return self._cookies def _set_cookies(self, cookies): self._cookies = cookies return http.parse_cookie(raw_cookie) def _get_files(self): if not hasattr(self, '_files'): self._load_post_and_files() return self._files GET = property(_get_get, _set_get) POST = property(_get_post, _set_post) COOKIES = property(_get_cookies, _set_cookies) FILES = property(_get_files) REQUEST = property(_get_request) Loading Loading
django/core/handlers/wsgi.py +10 −19 Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ from django.core.handlers import base from django.core.urlresolvers import set_script_prefix from django.utils import datastructures from django.utils.encoding import force_str, force_text from django.utils.functional import cached_property from django.utils import six # For backwards compatibility -- lots of code uses this in the wild! Loading Loading @@ -136,15 +137,11 @@ class WSGIRequest(http.HttpRequest): self._request = datastructures.MergeDict(self.POST, self.GET) return self._request def _get_get(self): if not hasattr(self, '_get'): @cached_property def GET(self): # The WSGI spec says 'QUERY_STRING' may be absent. raw_query_string = get_bytes_from_wsgi(self.environ, 'QUERY_STRING', '') self._get = http.QueryDict(raw_query_string, encoding=self._encoding) return self._get def _set_get(self, get): self._get = get return http.QueryDict(raw_query_string, encoding=self._encoding) def _get_post(self): if not hasattr(self, '_post'): Loading @@ -154,23 +151,17 @@ class WSGIRequest(http.HttpRequest): def _set_post(self, post): self._post = post def _get_cookies(self): if not hasattr(self, '_cookies'): @cached_property def COOKIES(self): raw_cookie = get_str_from_wsgi(self.environ, 'HTTP_COOKIE', '') self._cookies = http.parse_cookie(raw_cookie) return self._cookies def _set_cookies(self, cookies): self._cookies = cookies return http.parse_cookie(raw_cookie) def _get_files(self): if not hasattr(self, '_files'): self._load_post_and_files() return self._files GET = property(_get_get, _set_get) POST = property(_get_post, _set_post) COOKIES = property(_get_cookies, _set_cookies) FILES = property(_get_files) REQUEST = property(_get_request) Loading