From 5dbf59c2fc27dd6138df7a5b2fcbfbbfd325e410 Mon Sep 17 00:00:00 2001 From: Nate Coraor Date: Tue, 24 May 2011 05:33:07 -0400 Subject: [PATCH] =?UTF-8?q?Fix=20the=20non-working=20default=3D"true"=20fo?= =?UTF-8?q?r=20checkboxes,=20thanks=20Louise-Am=C3=A9lie=20Schmitt.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/galaxy/web/form_builder.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/galaxy/web/form_builder.py b/lib/galaxy/web/form_builder.py index 9db6679193d..d05738a78af 100644 --- a/lib/galaxy/web/form_builder.py +++ b/lib/galaxy/web/form_builder.py @@ -4,7 +4,7 @@ Classes for generating HTML forms import logging, sys, os, time from cgi import escape -from galaxy.util import restore_text, relpath, nice_size +from galaxy.util import restore_text, relpath, nice_size, string_as_bool from galaxy.web import url_for log = logging.getLogger(__name__) @@ -112,6 +112,8 @@ class CheckboxField(BaseField): # above for clarification. Basically, if value is not True, then it will always be a list with # 2 input fields ( a checkbox and a hidden field ) if the checkbox is checked. If it is not # checked, then value will be only the hidden field. + if isinstance( value, basestring ): + return string_as_bool( value ) return isinstance( value, list ) and len( value ) == 2 def set_checked(self, value): if isinstance( value, basestring ):