summaryrefslogtreecommitdiff
path: root/django/newforms/forms.py
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-04-26 13:30:48 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-04-26 13:30:48 +0000
commit439cb4047fb583d08149f28e2ce66a8edfe0efa7 (patch)
tree47ef30e70bf1d757f08b133d3aa47704db13c714 /django/newforms/forms.py
parent6c02565e4fb92c4cc3bfb45bcc89eb9aa299efdc (diff)
Fixed #4040 -- Changed uses of has_key() to "in". Slight performance
improvement and forward-compatible with future Python releases. Patch from Gary Wilson. git-svn-id: http://code.djangoproject.com/svn/django/trunk@5091 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/newforms/forms.py')
-rw-r--r--django/newforms/forms.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/django/newforms/forms.py b/django/newforms/forms.py
index 1f37da91ff..3df7a9e834 100644
--- a/django/newforms/forms.py
+++ b/django/newforms/forms.py
@@ -244,7 +244,7 @@ class BoundField(StrAndUnicode):
def as_widget(self, widget, attrs=None):
attrs = attrs or {}
auto_id = self.auto_id
- if auto_id and not attrs.has_key('id') and not widget.attrs.has_key('id'):
+ if auto_id and 'id' not in attrs and 'id' not in widget.attrs:
attrs['id'] = auto_id
if not self.form.is_bound:
data = self.form.initial.get(self.name, self.field.initial)