Merging heads of old, closed branch tls-sprint
authorArthur Lutz <arthur.lutz@logilab.fr>
Thu, 04 Apr 2019 13:49:34 +0200
branchtls-sprint
changeset 12560 dc6d44e69a70
parent 2022 31412adee482 (diff)
parent 1809 fb8c39cf0849 (current diff)
child 12561 290f44d445a3
Merging heads of old, closed branch
--- a/web/formwidgets.py	Thu May 14 12:48:32 2009 +0200
+++ b/web/formwidgets.py	Thu Apr 04 13:49:34 2019 +0200
@@ -199,26 +199,6 @@
 
     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 '<br/>\n'.join(options)
-
-
-class Radio(Input):
-    """<input type='radio'>, for field having a specific vocabulary. One
-    input will be generated for each possible value.
-    """
-    type = 'radio'
-
-    def render(self, form, field):
-        name, curvalues, attrs = self._render_attrs(form, field)
         domid = attrs.pop('id', None)
         options = []
         for i, (label, value) in enumerate(field.vocabulary(form)):
@@ -232,6 +212,12 @@
         return '\n'.join(options)
 
 
+class Radio(CheckBox):
+    """<input type='radio'>, for field having a specific vocabulary. One
+    input will be generated for each possible value.
+    """
+    type = 'radio'
+
 # javascript widgets ###########################################################
 
 class DateTimePicker(TextInput):