On Sep 5, 2006, at 4:11 AM, Timur Izhbulatov wrote: > > On Mon, Sep 04, 2006 at 10:46:06AM -0400, Kevin Dangoor wrote: >> >> On Sep 4, 2006, at 3:22 AM, Timur Izhbulatov wrote: >> >>> I'm porting my existing project to TG. The project uses Cheetah for >>> dynamic form >>> generation. For instance, my template is responsible for rendering >>> required >>> fields with an asterisk, plus some JavaScript checks. >>> >>> On this evidence I would like to use >>> formencode.htmlfill_schemabuilder to >>> generate embedded validation schema (it's very simple) along with >>> the form >>> itself (like in Subway). But I couldn't find any way to do this >>> straight away. >> >> You could try implementing your own template engine (it's a pretty >> simple interface) which does the Cheetah+schemabuilder work for you. > > You mean http://www.turbogears.org/docs/plugins/template.html? I > took a look at > the interface and the TurboCheetah plugin code as example.
Yes, that was the interface I meant. > Well, looks like it's possible to do the schema work somewhere in > load_module. > But how will I use the resulting schema for validation after that? > I will need > to make it available in the controller somehow. Start with the schema in the controller and pass it back to the template engine either via expose (I believe arbitrary arguments to expose will get passed through to the template engine, but I could be wrong, because that's not something I've ever used) *or* via the dict. Just as TurboGears itself uses "tg_*" values that are returned in the dict, you can have your template engine take advantage of things that are returned in the dict. Kevin --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

