Django

Code

Changeset 6451

Show
Ignore:
Timestamp:
10/03/07 20:20:27 (1 year ago)
Author:
mtredinnick
Message:

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).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/newforms/widgets.py

    r6450 r6451  
    9797 
    9898    def __init__(self, attrs=None, render_value=True): 
    99         self.attrs = attrs or {} 
     99        super(PasswordInput, self).__init__(attrs) 
    100100        self.render_value = render_value 
    101101 
     
    114114    """ 
    115115    def __init__(self, attrs=None, choices=()): 
     116        super(MultipleHiddenInput, self).__init__(attrs) 
    116117        # choices can be any iterable 
    117         self.attrs = attrs or {} 
    118118        self.choices = choices 
    119119 
     
    154154class CheckboxInput(Widget): 
    155155    def __init__(self, attrs=None, check_test=bool): 
     156        super(CheckboxInput, self).__init__(attrs) 
    156157        # check_test is a callable that takes a value and returns True 
    157158        # if the checkbox should be checked for that value. 
    158         self.attrs = attrs or {} 
    159159        self.check_test = check_test 
    160160 
     
    173173class Select(Widget): 
    174174    def __init__(self, attrs=None, choices=()): 
    175         self.attrs = attrs or {} 
     175        super(Select, self).__init__(attrs) 
    176176        # choices can be any iterable, but we may need to render this widget 
    177177        # multiple times. Thus, collapse it into a list so it can be consumed 
     
    212212class SelectMultiple(Widget): 
    213213    def __init__(self, attrs=None, choices=()): 
     214        super(SelectMultiple, self).__init__(attrs) 
    214215        # choices can be any iterable 
    215         self.attrs = attrs or {} 
    216216        self.choices = choices 
    217217