diff -r 3cebd690a114 -r f37ee6855e42 web/form.py --- a/web/form.py Wed Mar 11 19:50:33 2009 +0100 +++ b/web/form.py Wed Mar 11 19:51:08 2009 +0100 @@ -381,11 +381,18 @@ class CheckBox(Input): type = 'checkbox' - def _render_attrs(self, form, field): - name, values, attrs = super(CheckBox, self)._render_attrs(form, field) - if values and values[0]: - attrs['checked'] = u'checked' - return name, values, attrs + def render(self, form, field): + name, curvalues, attrs = self._render_attrs(form, field) + options = [] + for label, value in field.vocabulary(form): + if value in curvalues: + tag = tags.input(name=name, value=value, type=self.type, + checked='checked', **attrs) + else: + tag = tags.input(name=name, value=value, type=self.type, + **attrs) + options.append(tag + label) + return '
\n'.join(options) class Radio(Input):