Author: mtredinnick
Date: 2007-10-03 20:20:27 -0500 (Wed, 03 Oct 2007)
New Revision: 6451
Modified:
django/trunk/django/newforms/widgets.py
Log:
Changed some Widget subclasses to be consistent about how they handle the
passed in 'attrs' parameter. We now always copy it (by calling the parent's
__init__).
Modified: django/trunk/django/newforms/widgets.py
===================================================================
--- django/trunk/django/newforms/widgets.py 2007-10-04 01:12:00 UTC (rev
6450)
+++ django/trunk/django/newforms/widgets.py 2007-10-04 01:20:27 UTC (rev
6451)
@@ -96,7 +96,7 @@
input_type = 'password'
def __init__(self, attrs=None, render_value=True):
- self.attrs = attrs or {}
+ super(PasswordInput, self).__init__(attrs)
self.render_value = render_value
def render(self, name, value, attrs=None):
@@ -113,8 +113,8 @@
of values.
"""
def __init__(self, attrs=None, choices=()):
+ super(MultipleHiddenInput, self).__init__(attrs)
# choices can be any iterable
- self.attrs = attrs or {}
self.choices = choices
def render(self, name, value, attrs=None, choices=()):
@@ -153,9 +153,9 @@
class CheckboxInput(Widget):
def __init__(self, attrs=None, check_test=bool):
+ super(CheckboxInput, self).__init__(attrs)
# check_test is a callable that takes a value and returns True
# if the checkbox should be checked for that value.
- self.attrs = attrs or {}
self.check_test = check_test
def render(self, name, value, attrs=None):
@@ -172,7 +172,7 @@
class Select(Widget):
def __init__(self, attrs=None, choices=()):
- self.attrs = attrs or {}
+ super(Select, self).__init__(attrs)
# choices can be any iterable, but we may need to render this widget
# multiple times. Thus, collapse it into a list so it can be consumed
# more than once.
@@ -211,8 +211,8 @@
class SelectMultiple(Widget):
def __init__(self, attrs=None, choices=()):
+ super(SelectMultiple, self).__init__(attrs)
# choices can be any iterable
- self.attrs = attrs or {}
self.choices = choices
def render(self, name, value, attrs=None, choices=()):
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---