On Wed, Sep 06, 2006 at 07:24:46AM -0400, Kevin Dangoor wrote: > > On Sep 6, 2006, at 2:33 AM, Timur Izhbulatov wrote: > > > Sorry, but I still don't get your idea. I agree, I can pass the > > schema from the > > controller to the template engine through expose using its mapping > > argument. But > > how the validate decorator will receive it than? > > Ahh. I think I might have missed something with your original > thought. I thought the schema was known beforehand... > > if that's not the case, the only way at present to dynamically > provide a schema to validate is by passing a callable (eg a function) > to the decorator, and it will call that at the time that it wants to > do validation. (I know you can do this with the form, I'm not 100% > sure you can do this with a schema...)
That's what I was afraid of. I have to create my own decorator. The existing decorators I've seen (like validate) look rather complex (or even scary :) The problem is that I can build schema only when I already have a business object which I display form for. In my original application I get an object plus some metadata for validation from the model and pass everything to the template engine which generates the form, the validation logic resides in the controller. My initial goal was to have the form and the schema generated in one place and get rid of my own validation logic in favour of TG's validate. But taking into account that I have to write my own decorator and some callable for schema generation, looks like there is no point in using htmlfill_schemabuilder anymore. > Yeah, I was not envisioning the template engine creating the schema. > I was envisioning that the template engine would use a schema that is > passed in. Thank you for the clarification, Kevin! -- Timur Izhbulatov OILspace, 26 Leninskaya sloboda, bld. 2, 2nd floor, 115280 Moscow, Russia P:+7 495 105 7245 + ext.205 F:+7 495 105 7246 E:[EMAIL PROTECTED] Building Successful Supply Chains - One Solution At A Time. www.oilspace.com --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

