Skip to content

Commit ce31e36

Browse files
committed
Remove MergeDict
The class MergeDict is deprecated and will be removed in Django 1.9
1 parent f791792 commit ce31e36

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

rest_framework/request.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
from django.http.multipartparser import parse_header
1515
from django.utils import six
1616
from django.utils.datastructures import MultiValueDict
17-
from django.utils.datastructures import MergeDict as DjangoMergeDict
1817
from rest_framework import HTTP_HEADER_ENCODING
1918
from rest_framework import exceptions
2019
from rest_framework.settings import api_settings
@@ -61,15 +60,6 @@ def __exit__(self, *args, **kwarg):
6160
self.view.action = self.action
6261

6362

64-
class MergeDict(DjangoMergeDict, dict):
65-
"""
66-
Using this as a workaround until the parsers API is properly
67-
addressed in 3.1.
68-
"""
69-
def __init__(self, *dicts):
70-
self.dicts = dicts
71-
72-
7363
class Empty(object):
7464
"""
7565
Placeholder for unset attributes.
@@ -328,7 +318,8 @@ def _load_data_and_files(self):
328318
if not _hasattr(self, '_data'):
329319
self._data, self._files = self._parse()
330320
if self._files:
331-
self._full_data = MergeDict(self._data, self._files)
321+
self._full_data = self._data.copy()
322+
self._full_data.update(self._files)
332323
else:
333324
self._full_data = self._data
334325

@@ -392,7 +383,8 @@ def _perform_form_overloading(self):
392383
# At this point we're committed to parsing the request as form data.
393384
self._data = self._request.POST
394385
self._files = self._request.FILES
395-
self._full_data = MergeDict(self._data, self._files)
386+
self._full_data = self._data.copy()
387+
self._full_data.update(self._files)
396388

397389
# Method overloading - change the method and remove the param from the content.
398390
if (

0 commit comments

Comments
 (0)