Noufal schrieb:
> Hello everyone,
> 
> One of my controller methods generates a form with many of the default
> values taken from identity and from the database. These might (and
> often do) change everytime the URL is accessed or refreshed and so I
> can't create the form statically at the top of the controllers file
> and go ahead with that.
> 
> This whole thing would be cool if I didn't need validation but I do
> and heavily so. Hand rolling my own validation system would be
> reinventing the wheel I think.
> 
> I looked through the mailing list archives but couldn't find anything
> really useful. I followed something similar to the forms tutorial and
> declared my class (inherited from widgets.WidgetsList) on the top
> level but I can't really instantiate it properly (since the fields
> have to be class level).
> 
> I'd appreciate any pointers on how to go about this.

First of all: you can pass a callable to @validate(form=X), so when X is 
a function that rebuilds the very same form it will be used for validation.

Secondly, I sense a design-smell here. Most cases of dynamicsm should be 
handleable by forms and schemas for validation - because the variance is 
constrained by what you can save to your model, which isn't subject of 
runtime-changes.

If you'd disclose more of your actual use-case, we might be able to make 
proper suggestions.

Diez

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to