summaryrefslogtreecommitdiff
path: root/django/http
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2007-05-12 02:36:05 +0000
committerAdrian Holovaty <adrian@holovaty.com>2007-05-12 02:36:05 +0000
commit415e84ad53e0d0d8f7df87784c1893489bdbe0b8 (patch)
tree09541f8319c45ec51fb44154534abc41cb86aee9 /django/http
parent4938c8ea6db6f23ebb0883b8a092985344508b25 (diff)
newforms-admin: Merged to [5194]
git-svn-id: http://code.djangoproject.com/svn/django/branches/newforms-admin@5195 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/http')
-rw-r--r--django/http/__init__.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/django/http/__init__.py b/django/http/__init__.py
index ed2c128a16..74a4eff55c 100644
--- a/django/http/__init__.py
+++ b/django/http/__init__.py
@@ -29,12 +29,12 @@ class HttpRequest(object):
def __getitem__(self, key):
for d in (self.POST, self.GET):
- if d.has_key(key):
+ if key in d:
return d[key]
raise KeyError, "%s not found in either POST or GET" % key
def has_key(self, key):
- return self.GET.has_key(key) or self.POST.has_key(key)
+ return key in self.GET or key in self.POST
def get_full_path(self):
return ''
@@ -57,7 +57,7 @@ def parse_file_upload(header_dict, post_data):
# name_dict is something like {'name': 'file', 'filename': 'test.txt'} for file uploads
# or {'name': 'blah'} for POST fields
# We assume all uploaded files have a 'filename' set.
- if name_dict.has_key('filename'):
+ if 'filename' in name_dict:
assert type([]) != type(submessage.get_payload()), "Nested MIME messages are not supported"
if not name_dict['filename'].strip():
continue
@@ -66,7 +66,7 @@ def parse_file_upload(header_dict, post_data):
filename = name_dict['filename'][name_dict['filename'].rfind("\\")+1:]
FILES.appendlist(name_dict['name'], {
'filename': filename,
- 'content-type': (submessage.has_key('Content-Type') and submessage['Content-Type'] or None),
+ 'content-type': 'Content-Type' in submessage and submessage['Content-Type'] or None,
'content': submessage.get_payload(),
})
else:
@@ -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):