mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	Fixed #4270 -- Don't permit deleting of items from an immutable QueryDict.
Thanks, Gary Wilson. git-svn-id: http://code.djangoproject.com/svn/django/trunk@5187 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
		| @@ -91,6 +91,10 @@ class QueryDict(MultiValueDict): | ||||
|         self._assert_mutable() | ||||
|         MultiValueDict.__setitem__(self, key, value) | ||||
|  | ||||
|     def __delitem__(self, key): | ||||
|         self._assert_mutable() | ||||
|         super(QueryDict, self).__delitem__(key) | ||||
|  | ||||
|     def __copy__(self): | ||||
|         result = self.__class__('', mutable=True) | ||||
|         for key, value in dict.items(self): | ||||
|   | ||||
| @@ -96,6 +96,12 @@ MultiValueDictKeyError: "Key 'foo' not found in <MultiValueDict: {}>" | ||||
| >>> q['name'] | ||||
| 'john' | ||||
|  | ||||
| >>> del q['name'] | ||||
| >>> 'name' in q | ||||
| False | ||||
|  | ||||
| >>> q['name'] = 'john' | ||||
|  | ||||
| >>> q.get('foo', 'default') | ||||
| 'default' | ||||
|  | ||||
| @@ -367,6 +373,11 @@ AttributeError: This QueryDict instance is immutable | ||||
| >>> q.urlencode() | ||||
| 'vote=yes&vote=no' | ||||
|  | ||||
| >>> del q['vote'] | ||||
| Traceback (most recent call last): | ||||
| ... | ||||
| AttributeError: This QueryDict instance is immutable | ||||
|  | ||||
| """ | ||||
|  | ||||
| from django.http import QueryDict | ||||
|   | ||||
		Reference in New Issue
	
	Block a user