Ok, I had time to investigate.

Here's your problem. The BooleanWidget offers either a '1' or '0' on the REQUEST when you post. Your validators catch that correctly.

Let's look at the isValid guard on auto_pending transitition (introduced in remember 1.0b1)

219     security.declarePublic('isValid')
220     def isValid(self):
221         """
222         Check to make sure a Member object's fields satisfy schema
223         constraints
224         """
225         errors = {}
226         # make sure object has required data and metadata
227         self.Schema().validate(self, None, errors, 1, 1)
228         if errors:
229             return 0
230         return 1

When this executes the last time your object has already had those '1' values for the BooleanFields correctly converted to True. True and False are the only valid options for a BooleanField.

You are not the one at fault. The BooleanWidget uses clever javascript to handle checkboxes, but in the process it does not correctly define the name of the input as say foo:int. At least that marshalling will cause the variable to appear in the request as a 0 or 1 (not strings) which in Python can usually be interpreted the same as proper booleans.

To fix this you have to slightly rewrite your validators. Here's one:

162     def validate_accept_terms_of_use(self, value):
163 LOG("validate_accept_terms_of_use", INFO, "The value=%s" % str(value))
164         if (value == True) or (value == '1'):
165             return None
166 return 'You must read and accept the Terms of Use before you can join the site.'

Make the other one the same (with a different message naturally).

Cheers
H




_______________________________________________
Product-Developers mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/product-developers

Reply via email to