Question about code at the bottom of page 109 in Chapter 7

1 view
Skip to first unread message

Matt Wilson

unread,
Nov 17, 2007, 6:20:29 PM11/17/07
to tg.book
I didn't see this page mentioned in the errata.

This is the code I mean:

class ProjectFields(widgets.WidgetsList):
title = TextField(label="project",
validator=validators.NotEmpty())
client_revenue = widgets.TextField(validator=validators.Number())
project_form = widgets.TableForm(fields=ProjectFields(),

action="save_project_test")

One minor detail: this code uses widgets.TextField and TextField.

More importantly, I think the indentation is wrong in the last line.
I think project_form is not supposed to be a class attribute of the
ProjectField class.

Should the code look more like this?

class ProjectFields(widgets.WidgetsList):
title = widgets.TextField(label="project",
validator=validators.NotEmpty())
client_revenue = widgets.TextField(validator=validators.Number())

# Moved outside the class.
project_form = widgets.TableForm(fields=ProjectFields(),
action="save_project_test")

But maybe I'm missing something.

Matt
Reply all
Reply to author
Forward
0 new messages