def selection_html(self, selections, context): result = [] id = 0 for value, desc in selections: id = id + 1 result.append(html.input( type='checkbox', name=context.name(self), id="%s_%i" % (context.name(self), id), value=value, checked=self.selected(value, context.default(self)) and "checked" or None)) result.append(html.label( " " + str(desc), for_="%s_%i" % (context.name(self), id))) result.append(html.br()) return result
def selection_html(self, selections, context): id = 0 result = [] for value, desc in selections: id = id + 1 if self.selected(value, context.default(self)): checked = 'checked' else: checked = None result.append(html.input( type='radio', name=context.name(self), value=value, id="%s_%i" % (context.name(self), id), checked=checked)) result.append(html.label( for_='%s_%i' % (context.name(self), id), c=desc)) result.append(html.br()) return result