[CentralOH] [webpy] Checkboxes

W. Martin Borgert debacle at debian.org
Wed May 25 01:54:04 CEST 2011


On 2011-05-24 17:41, Mark Erbaugh wrote:
> Did something change with webpy's handling of Checkboxes on web forms between 0.3 and 0.34 (and 0.35).

Yes, that's why my own application contains the following
compatibility code:


# this is copied from 0.32, as 0.33 works differently
class Checkbox(web.form.Input):
    def render(self):
        checked_description = self.attrs.pop('checked_description', None)
        x = u'<input name="%s" type="checkbox" ' % websafe(self.name)
        if self.value: x += u'checked="checked" '
        x += force_unicode(self.addatts())
        x += u' />'
        x += self.rendernote(self.note)
        if checked_description:
            return '<label>%s %s</label>' % (x, checked_description)
        else:
            return x


Cheers


More information about the CentralOH mailing list