diff options
| author | Tom Christie | 2013-01-15 17:53:24 +0000 |
|---|---|---|
| committer | Tom Christie | 2013-01-15 17:53:24 +0000 |
| commit | 71e55cc4f6300959398f7aef4a8d91b6a6a2af57 (patch) | |
| tree | 68c2080034263d897741da33cbc5e09746006257 /rest_framework/request.py | |
| parent | 52847a215d4e8de88e81d9ae79ce8bee9a36a9a2 (diff) | |
| parent | e1076cfb49b6293aa837cf7bdb4c11988892c598 (diff) | |
| download | django-rest-framework-71e55cc4f6300959398f7aef4a8d91b6a6a2af57.tar.bz2 | |
Merge with latest master
Diffstat (limited to 'rest_framework/request.py')
| -rw-r--r-- | rest_framework/request.py | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/rest_framework/request.py b/rest_framework/request.py index 5870be82..b7133608 100644 --- a/rest_framework/request.py +++ b/rest_framework/request.py @@ -21,8 +21,8 @@ def is_form_media_type(media_type): Return True if the media type is a valid form media type. """ base_media_type, params = parse_header(media_type) - return base_media_type == 'application/x-www-form-urlencoded' or \ - base_media_type == 'multipart/form-data' + return (base_media_type == 'application/x-www-form-urlencoded' or + base_media_type == 'multipart/form-data') class Empty(object): @@ -169,6 +169,15 @@ class Request(object): self._user, self._auth = self._authenticate() return self._user + @user.setter + def user(self, value): + """ + Sets the user on the current request. This is necessary to maintain + compatilbility with django.contrib.auth where the user proprety is + set in the login and logout functions. + """ + self._user = value + @property def auth(self): """ @@ -179,6 +188,14 @@ class Request(object): self._user, self._auth = self._authenticate() return self._auth + @auth.setter + def auth(self, value): + """ + Sets any non-user authentication information associated with the + request, such as an authentication token. + """ + self._auth = value + def _load_data_and_files(self): """ Parses the request content into self.DATA and self.FILES. |
