Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #253 (closed defect: fixed)

Opened 13 years ago

Last modified 12 years ago

[patch] checkbox widget requires validator

Reported by: stephen@… Owned by: anonymous
Priority: high Milestone: 0.9
Component: TG Widgets Version:
Severity: major Keywords:
Cc:

Description

When using the fastdata package with my model, I found that this:

@fastdata.formmaker.column_widget.when("isinstance(column, col.SOBoolCol)")
def column_boolean(column):
    return widgets.CheckBox(column.name)

presented a problem, because when a checkbox is not checked, the key/value doesn't come back as 'columname'/None, it doesn't come back at all.

The fix is trivial, the CheckBox? widget requires a formencode.validators.Bool() validator, and an absent value will be taken as false.

Attachments

checkboxfix.diff Download (324 bytes) - added by stephen@… 13 years ago.
patch against r358

Change History

Changed 13 years ago by stephen@…

patch against r358

comment:1 Changed 13 years ago by kevin

  • Status changed from new to closed
  • Resolution set to fixed
  • Milestone set to 0.9

Checkboxes can actually have a value other than true/false. But, it seems like a reasonable default to have a checkbox return a boolean. I've also added the rule for boolean columns to formmaker.

comment:2 Changed 13 years ago by kevin

committed in [361]

Note: See TracTickets for help on using tickets.