Roundup Tracker - Issues

Issue 1101492

classification
Properties of type *BooleanHTMLProperty* loose selection
Type: Severity: normal
Components: Web interface Versions:
process
Status: closed fixed
:
: richard : marlonvdb, richard
Priority: normal :

Created on 2005-01-13 09:15 by marlonvdb, last changed 2005-02-14 00:03 by richard.

Messages
msg1820 Author: [hidden] (marlonvdb) Date: 2005-01-13 09:15
Properties of type *BooleanHTMLProperty* do loose the
*No* selection if a form is submitted for the second
type (e.g. like forms that have a pre-filter submit).
This is caused by the *field* method for that class. In
the method there is a test on self._value at line 1280
(0.7.11). Thus any value other than None, '' or False
in *_value* will give the a True result.
The radio buttons have as value 'yes' and 'no'. So on a
submit either 'yes' or 'no' is submitted. When the
submit results in a backend update, _value will get
either True or False from the backend. But if the
submit did not update the backend, _value will be
either 'yes' or 'no'. Both these values will result in
True in the test at line 1280 causing the 'Yes' radio
button to be checked even if the previous selection was
'No'.

The next patch will solve this problem:

Index: cgi/templating.py
===================================================================
@@ -1276,8 +1276,7 @@
         if not self.is_edit_ok():
             return self.plain()
 
-        checked = self._value and "checked" or ""
-        if self._value:
+        if self._value and self._value != 'no':
             s = self.input(type="radio",
name=self._formname, value="yes",
                 checked="checked")
             s += 'Yes'

Also doesn't have line 1279 any meaning. The *checked*
variable isn't used anywhere and could be removed.

Best regards,
Marlon
msg1821 Author: [hidden] (richard) Date: 2005-02-14 00:03
Logged In: YES 
user_id=6405

Fixed in 0.8 
History
Date User Action Args
2005-01-13 09:15:55marlonvdbcreate