mirror of
https://github.com/django/django.git
synced 2024-12-23 01:25:58 +00:00
add _mutable class attribute to MultiValueDict, like QueryDict
This commit is contained in:
parent
3e84dfbd24
commit
5aafc222ad
@ -163,7 +163,7 @@ class MultiPartParser:
|
||||
|
||||
# Create the data structures to be used later.
|
||||
self._post = QueryDict(mutable=True)
|
||||
self._files = MultiValueDict(mutable=True)
|
||||
self._files = MultiValueDict()
|
||||
|
||||
# Instantiate the parser and stream:
|
||||
stream = LazyStream(ChunkIter(self._input_data, self._chunk_size))
|
||||
|
@ -69,9 +69,11 @@ class MultiValueDict(dict):
|
||||
single name-value pairs.
|
||||
"""
|
||||
|
||||
_mutable = True
|
||||
|
||||
def __init__(self, key_to_list_mapping=(), mutable=True):
|
||||
self._mutable = mutable
|
||||
super().__init__(key_to_list_mapping)
|
||||
self._mutable = mutable
|
||||
|
||||
def __repr__(self):
|
||||
return "<%s: %s>" % (self.__class__.__name__, super().__repr__())
|
||||
@ -117,7 +119,7 @@ class MultiValueDict(dict):
|
||||
self.__dict__.update(obj_dict)
|
||||
|
||||
def _assert_mutable(self):
|
||||
if hasattr(self, '_mutable') and not self._mutable:
|
||||
if not self._mutable:
|
||||
raise AttributeError("This MultiValueDict instance is immutable")
|
||||
|
||||
def get(self, key, default=None):
|
||||
|
Loading…
Reference in New Issue
Block a user