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 #2264 (closed documentation: fixed)

Opened 10 years ago

Last modified 10 years ago

Documentation Error in ToscaWidgets Tutorial

Reported by: pedersen Owned by:
Priority: normal Milestone: 2.0rc1
Component: Documentation Version: 2.0b7
Severity: normal Keywords:


At this location:  http://www.turbogears.org/2.0/docs/main/ToscaWidgets/forms.html#introduction

The model columns are described as follows:

    id = Column(Integer, primary_key=True)
    title = Column(String(100), nullable=False)
    description = Column(Text, nullable=True)
    year = Column(Integer, nullable=True)
    genre = Column(String(100), nullable=True)
    release_date = Column(Date, nullable=True)

However, every use of genre is store an integer. This results in an inability to properly build the update form, as the SelectSingleField? will be using an integer, while the options are using a string that happens to be a number. As a result, the "selected" option will never be present in the drop down that gets displayed to the user, which means that any selection done will appear to never take place.

The fix is simple: Define genre as follows:

    genre = Column(Integer, nullable=True)

After that, update becomes easy again, and things work as expected.

Change History

comment:1 Changed 10 years ago by chrisz

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

Right, the tutorial is inconsistent about that. We could also change the SingleSelectField options, but I think your fix is better in terms of database normalization. Fixed in r6484.

Note: See TracTickets for help on using tickets.