I'm no expert, but I think you're over-complicating the problem. The
example is just missing the initialization of the two variables, values and
submit_action. It does no harm to just add those two initializing
statements and then saves you the url requirements later. Also, you'd have
to add additional code to check to see if this was an add or an update so
that this fix would work under both circumstances.
-Jim
-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of tamara6
Sent: Sunday, December 31, 2006 10:39 AM
To: TurboGears
Subject: [TurboGears] Re: bookmarker example trouble
So I've figured out what the problem is. The submit action to the new
bookmark form is simply "/save_bookmark", which means that args[0] is
no longer "add" (in fact, it is blank). When there is a problem with
the validation, bookmark gets called again, but this time args[0] is
neither "add" nor "edit" so it goes straight to the last line:
return dict(form=bookmark_form, values=values, action=submit_action)
and, since values was not set earlier, we get the error.
The fix, I have found, is to change the add form submit action to
submit_action= "/save_bookmark/add"
now that args[0] is "add" again, everything is OK, and my forms show up
with their errors highlighted properly.
Hopefully this will help someone else who ends up with the same problem
:-)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---