diff options
| author | Sébastien Piquemal | 2012-02-07 15:38:54 +0200 |
|---|---|---|
| committer | Sébastien Piquemal | 2012-02-07 15:38:54 +0200 |
| commit | 21292d31e7ad5ec731c9ef3e471f90cb29054686 (patch) | |
| tree | 74bed0e6a3970380c8ac611e69c5b5179b8d2cd3 /djangorestframework/parsers.py | |
| parent | ca96b4523b4c09489e4bfe726a894a5c6ada78aa (diff) | |
| download | django-rest-framework-21292d31e7ad5ec731c9ef3e471f90cb29054686.tar.bz2 | |
cleaned Request/Response/mixins to have similar interface
Diffstat (limited to 'djangorestframework/parsers.py')
| -rw-r--r-- | djangorestframework/parsers.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/djangorestframework/parsers.py b/djangorestframework/parsers.py index 5fc5c71e..c041d7ce 100644 --- a/djangorestframework/parsers.py +++ b/djangorestframework/parsers.py @@ -43,7 +43,7 @@ class BaseParser(object): media_type = None - def __init__(self, view): + def __init__(self, view=None): """ Initialize the parser with the ``View`` instance as state, in case the parser needs to access any metadata on the :obj:`View` object. @@ -167,10 +167,9 @@ class MultiPartParser(BaseParser): `data` will be a :class:`QueryDict` containing all the form parameters. `files` will be a :class:`QueryDict` containing all the form files. """ - # TODO: now self.view is in fact request, but should disappear ... - upload_handlers = self.view._get_upload_handlers() + upload_handlers = self.view.request._get_upload_handlers() try: - django_parser = DjangoMultiPartParser(self.view.META, stream, upload_handlers) + django_parser = DjangoMultiPartParser(self.view.request.META, stream, upload_handlers) except MultiPartParserError, exc: raise ImmediateResponse( content={'detail': 'multipart parse error - %s' % unicode(exc)}, |
