Skip to content

Commit

Permalink
Avoid spurious name= on SelectionList/SelectionTable [bug:76]
Browse files Browse the repository at this point in the history
  • Loading branch information
paj committed Nov 3, 2010
1 parent 01a1f57 commit 7277c23
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
16 changes: 8 additions & 8 deletions tests/test_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ class TestMultipleSelectField(WidgetTest):
class TestSelectionList(WidgetTest):
widget = SelectionList
attrs = {'css_class':'something', 'field_type':'test', 'options':(('a','1'), ('b', '2'), ('c', '3')), 'id':'something'}
expected = """<ul class="something" id="something" name="something">
expected = """<ul class="something" id="something">
<li>
<input type="test" name="something" value="a" id="something:0">
<label for="something:0">1</label>
Expand All @@ -213,7 +213,7 @@ class TestSelectionList(WidgetTest):
class TestRadioButtonList(WidgetTest):
widget = RadioButtonList
attrs = {'css_class':'something', 'options':(('a','1'), ('b', '2'), ('c', '3')), 'id':'something'}
expected = """<ul class="something" id="something" name="something">
expected = """<ul class="something" id="something">
<li>
<input type="radio" name="something" value="a" id="something:0">
<label for="something:0">1</label>
Expand All @@ -229,7 +229,7 @@ class TestRadioButtonList(WidgetTest):
class TestCheckBoxList(WidgetTest):
widget = CheckBoxList
attrs = {'css_class':'something', 'options':(('a','1'), ('b', '2'), ('c', '3')), 'id':'something'}
expected = """<ul class="something" id="something" name="something">
expected = """<ul class="something" id="something">
<li>
<input type="checkbox" name="something" value="a" id="something:0">
<label for="something:0">1</label>
Expand All @@ -243,7 +243,7 @@ class TestCheckBoxList(WidgetTest):
</ul>
"""
def test_option_has_value(self):
expected = """<ul class="something" id="something" name="something">
expected = """<ul class="something" id="something">
<li>
<input type="checkbox" name="something" value="a" id="something:0" checked>
<label for="something:0">a</label>
Expand All @@ -263,7 +263,7 @@ def test_option_has_value(self):
class TestSelectionTable(WidgetTest):
widget = SelectionTable
attrs = {'css_class':'something', 'field_type':'test', 'options':(('a','1'), ('b', '2'), ('c', '3')), 'id':'something'}
expected = """<table class="something" id="something" name="something">
expected = """<table class="something" id="something">
<tbody>
<tr>
<td>
Expand All @@ -285,7 +285,7 @@ class TestSelectionTable(WidgetTest):
</table>"""

def test_option_leftover_chunk(self):
expected = """<table class="something" id="something" name="something">
expected = """<table class="something" id="something">
<tbody>
<tr>
<td>
Expand All @@ -312,7 +312,7 @@ def test_option_leftover_chunk(self):
class TestRadioButtonTable(WidgetTest):
widget = RadioButtonTable
attrs = {'css_class':'something', 'options':(('a','1'), ('b', '2'), ('c', '3')), 'id':'something'}
expected = """<table class="something" id="something" name="something">
expected = """<table class="something" id="something">
<tbody>
<tr>
<td>
Expand All @@ -336,7 +336,7 @@ class TestRadioButtonTable(WidgetTest):
class TestCheckBoxTable(WidgetTest):
widget = CheckBoxTable
attrs = {'css_class':'something', 'options':(('a','1'), ('b', '2'), ('c', '3')), 'id':'something'}
expected = """<table class="something" id="something" name="something">
expected = """<table class="something" id="something">
<tbody>
<tr>
<td>
Expand Down
2 changes: 2 additions & 0 deletions tw2/forms/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ class MultipleSelectField(MultipleSelectionField):
class SelectionList(SelectionField):
selected_verb = "checked"
template = "tw2.forms.templates.selection_list"
name = None


class RadioButtonList(SelectionList):
Expand All @@ -298,6 +299,7 @@ class SelectionTable(SelectionField):
cols = twc.Param('Number of columns', default=1)
options_rows = twc.Variable()
grouped_options_rows = twc.Variable()
name = None

def _group_rows(self, seq, size):
if not hasattr(seq, 'next'):
Expand Down

0 comments on commit 7277c23

Please sign in to comment.