You are correct in that ming had an issue with bool that was fixed in the update. However, this was an issue with the class SproxCheckBox(CheckBox) always being checked when displayed rather than being checked or unchecked depending on the bool value in the database. The checked attr was always being passed to the checkbox widget so that the box was always checked when displayed. Simply having "checked=" in the html causes the the box to be checked. The code I added removes the "checked" attr if the self.value is false so that the checkbox is in agreement with the database. It may be better to check for this in tw2.form.widgets.widgets.py class CheckBox.
The "value" attr needs to remain "true' at all times so that when the box is checked and the form is submitted, 'true' is passed as a value. If the box is not checked, then '' is passed. On submission, the controller then checks for a value and passes it to the database. I am a newbie with Turbogears, so please feel free to correct and dirrect me. On Friday, February 15, 2013 2:51:06 PM UTC-6, Alessandro Molina wrote: > > Should have already been fixed, you can find more informations at > https://bitbucket.org/percious/sprox/issue/41/sprox-with-ming-doesnt-work-with-booland > a work-around until the new release is done. > > Thanks anyway for reporting this! > > > On Fri, Feb 15, 2013 at 9:35 PM, Stuart Zurcher > <[email protected]<javascript:> > > wrote: > >> Thanks for the great work you guys are doing. >> >> I had an issue where SproxCheckBox would default to true rather than >> displaying what is in the data. I had to change the code in >> sprox.widgets.tw2widgets.widget.py. Following is the change I made. >> >> >> >>> class SproxCheckBox(CheckBox): >>> def prepare(self): >>> super(SproxCheckBox, self).prepare() >>> self.attrs['value'] = self.value >>> if self.attrs['value'] == 'False': >>> self.attrs.pop("checked", None) #checkbox automatically checked >>> if checked in self.attrs >>> >> >> Hopefully this will help someone... >> >> >> On Monday, January 21, 2013 3:42:36 PM UTC-6, Alessandro Molina wrote: >>> >>> Today Chris Perkins released the new version of Sprox, this is a minor >>> release with some major improvements for people using Sprox and the >>> TurboGears admin. Most notable change is initial support for SQLAlchemy >>> 0.8, some bugs might still be around, but things seem to work correctly. >>> >>> Other changes include: >>> - Fix MultipleSelection validation with TW2 not working correctly >>> (crash on safe_validate) >>> - Fix broken Unicode validation for strings on TW1 >>> - Fix ming provider trying to cast already correctly casted datetimes >>> - When available use the new ming.odm namespace instead of the old >>> ming.orm >>> - Fix fields being removed even when specified in add_fields >>> >> -- >> You received this message because you are subscribed to the Google Groups >> "TurboGears" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> To post to this group, send email to [email protected]<javascript:> >> . >> Visit this group at http://groups.google.com/group/turbogears?hl=en. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> > > -- You received this message because you are subscribed to the Google Groups "TurboGears" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/turbogears?hl=en. For more options, visit https://groups.google.com/groups/opt_out.

