Previously Jonathan Vanasco wrote:
>
> i'm trying, without any luck, to fill a form with default values
>
> in my application we have
>
> -------
> class Form:
> """basic form validation"""
> pass
>
> class Controller:
> def index(self):
> print form
>
> @validator
> def submit(self):
> some advanced validation that is not appropriate to put in the
> form class
> if errors:
> self.form_errors{}= errors
> return self.index()
> -------
>
> the issue i keep running into, is that i can't find a way to push any
> data from the request / untained info on the submit into a reprint of
> the index.
This is what I use with genshi:
from genshi import HTML
from genshi.filters import HTMLFormFiller
# Insert the form parameters back into the form
filler=HTMLFormFiller(data=params)
stream=HTML(result) | filler
return stream.render(method="xhtml")
formencode also has a htmlfill utility method you can use.
Wichert.
--
Wichert Akkerman <[EMAIL PROTECTED]> It is simple to make things.
http://www.wiggy.net/ It is hard to make things simple.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pylons-discuss" 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/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---