diff options
Diffstat (limited to 'djangorestframework')
| -rw-r--r-- | djangorestframework/modelresource.py | 2 | ||||
| -rw-r--r-- | djangorestframework/parsers.py | 9 | ||||
| -rw-r--r-- | djangorestframework/resource.py | 3 |
3 files changed, 12 insertions, 2 deletions
diff --git a/djangorestframework/modelresource.py b/djangorestframework/modelresource.py index a9605d4a..2b0e719c 100644 --- a/djangorestframework/modelresource.py +++ b/djangorestframework/modelresource.py @@ -121,7 +121,7 @@ class ModelResource(Resource): if inspect.ismethod(f) and len(inspect.getargspec(f)[0]) == 1: ret = _any(f()) else: - ret = str(thing) # TRC TODO: Change this back! + ret = unicode(thing) # TRC TODO: Change this back! return ret diff --git a/djangorestframework/parsers.py b/djangorestframework/parsers.py index 0d5121e9..f48f2f59 100644 --- a/djangorestframework/parsers.py +++ b/djangorestframework/parsers.py @@ -118,3 +118,12 @@ class FormParser(BaseParser): return data +# TODO: Allow parsers to specify multiple media types +class MultipartParser(FormParser): + """The default parser for multipart form data. + Return a dict containing a single value for each non-reserved parameter. + """ + + media_type = 'multipart/form-data' + + diff --git a/djangorestframework/resource.py b/djangorestframework/resource.py index c743ce8f..b1f48f06 100644 --- a/djangorestframework/resource.py +++ b/djangorestframework/resource.py @@ -42,7 +42,8 @@ class Resource(ParserMixin, FormValidatorMixin, OverloadedContentMixin, Overload # List of content-types the resource can read from parsers = ( parsers.JSONParser, parsers.XMLParser, - parsers.FormParser ) + parsers.FormParser, + parsers.MultipartParser ) # List of all authenticating methods to attempt authenticators = ( authenticators.UserLoggedInAuthenticator, |
