summaryrefslogtreecommitdiff
path: root/Mailman/htmlformat.py
diff options
context:
space:
mode:
authorbwarsaw2000-06-20 05:38:42 +0000
committerbwarsaw2000-06-20 05:38:42 +0000
commit0d17969d2fae92d72bc60e065d7a4dde62793c84 (patch)
treea4923a8a324149a4c6462fc1b248aa3144fbf129 /Mailman/htmlformat.py
parent3e8b587c9b36650a44c8fe7530b4fdc0e6e66303 (diff)
downloadmailman-0d17969d2fae92d72bc60e065d7a4dde62793c84.tar.gz
mailman-0d17969d2fae92d72bc60e065d7a4dde62793c84.tar.zst
mailman-0d17969d2fae92d72bc60e065d7a4dde62793c84.zip
Diffstat (limited to 'Mailman/htmlformat.py')
-rw-r--r--Mailman/htmlformat.py21
1 files changed, 13 insertions, 8 deletions
diff --git a/Mailman/htmlformat.py b/Mailman/htmlformat.py
index 329afc6fa..f372fb794 100644
--- a/Mailman/htmlformat.py
+++ b/Mailman/htmlformat.py
@@ -437,7 +437,8 @@ class VerticalSpacer:
return output
class RadioButtonArray:
- def __init__(self, name, button_names, checked=None, horizontal=1):
+ def __init__(self, name, button_names, checked=None, horizontal=1,
+ values=None):
# XXX: horizontal doesn't really work, and besides there's no good way
# to ask for this in the GetConfigOptions(). -baw
self.button_names = button_names
@@ -445,18 +446,22 @@ class RadioButtonArray:
self.name = name
self.checked = checked
self.horizontal = horizontal
+ if values is not None:
+ assert len(values) == len(button_names)
+ self.values = values
+ else:
+ self.values = range(len(button_names))
def Format(self, indent=0):
t = Table(cellspacing=5)
items = []
l = len(self.button_names)
- for i in range(l):
- if self.checked == i:
- items.append(RadioButton(self.name, i, 1))
- items.append(self.button_names[i])
- else:
- items.append(RadioButton(self.name, i))
- items.append(self.button_names[i])
+ for i, name, value in map(None,
+ range(len(self.button_names)),
+ self.button_names, self.values):
+ checked = (self.checked == i)
+ items.append(RadioButton(self.name, value, checked))
+ items.append(name)
if self.horizontal:
t.AddRow(items)
else: