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 #2376 (closed defect: fixed)

Opened 10 years ago

Last modified 10 years ago

Impossible to pass empty strings/dicts/lists/zero-based values as default value of widgets

Reported by: xaka Owned by: Chris Arndt
Priority: normal Milestone: 1.0.x bugfix
Component: TurboGears Version: 1.1 HEAD
Severity: normal Keywords: widgets
Cc:

Description

For example i want to pass 0 as default value (int, not a string):

field = turbogears.widgets.TextField(name='test', default=0)
print field.default # will output None

Reason of that is invalid expression in Widget constructor:

if default:
    self.default = default

Which should be changed to:

if default is not None:
    self.default = default

Change History

comment:1 Changed 10 years ago by Chris Arndt

  • Owner set to Chris Arndt
  • Status changed from new to assigned
  • Keywords widgets added
  • Milestone changed from 1.x to 1.0.x bugfix

Confirmed. I'll test your solution and include the fix into upcoming 1.0.9 and 1.1 final if everything is ok.

comment:2 Changed 10 years ago by Chris Arndt

  • Status changed from assigned to closed
  • Resolution set to fixed

Fixed with r6736 in all 1.x branches and tests added.

Note: See TracTickets for help on using tickets.