From 28b9d322a250d1b2c38aae039bd10ba0a7ba6fb5 Mon Sep 17 00:00:00 2001 From: mdipierro Date: Tue, 17 Dec 2013 16:50:42 -0600 Subject: [PATCH] fixed 1821:RadioWidget and CheckboxesWidget wrong behavior, thanks Paolo Caruccio --- VERSION | 2 +- gluon/sqlhtml.py | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/VERSION b/VERSION index 5e4667b0..bee3b373 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.8.2-stable+timestamp.2013.12.17.16.41.58 +Version 2.8.2-stable+timestamp.2013.12.17.16.49.17 diff --git a/gluon/sqlhtml.py b/gluon/sqlhtml.py index 0be5b768..2a417c78 100644 --- a/gluon/sqlhtml.py +++ b/gluon/sqlhtml.py @@ -45,6 +45,9 @@ except ImportError: table_field = re.compile('[\w_]+\.[\w_]+') widget_class = re.compile('^\w*') +def add_class(a,b): + return a+' '+b if a else b + def represent(field, value, record): f = field.represent if not callable(f): @@ -334,7 +337,7 @@ class RadioWidget(OptionsWidget): attr = cls._attributes(field, {}, **attributes) - attr['_class'] = attr.get('_class', 'web2py_radiowidget') + attr['_class'] = add_class(attr.get('_class'), 'web2py_radiowidget') requires = field.requires if not isinstance(requires, (list, tuple)): @@ -398,7 +401,7 @@ class CheckboxesWidget(OptionsWidget): values = [str(value)] attr = cls._attributes(field, {}, **attributes) - attr['_class'] = attr.get('_class', 'web2py_checkboxeswidget') + attr['_class'] = add_class(attr.get('_class'), 'web2py_checkboxeswidget') label = attr.get('label',True)