That would work if I had access to the argument list coming back from
cherry py and/or was able to pass in my own arguments to the callable
at run-time.  any idea if this is possible?

-chris

On Mar 22, 7:39 am, Kevin Dangoor <[EMAIL PROTECTED]> wrote:
> did you know that the validate decorator can take a callable? (I
> believe that's what fastdata does).
>
> Kevin
>
> On Mar 20, 2007, at 3:29 PM, percious wrote:
>
>
>
>
>
> > """
> > As many of you know I have been working on a project to replace
> > both FastData and Catwalk in one fail swoop.  Right now we are sort
> > of stuck on field validation because we need extra information in our
> > validation routines in order to process the table definitions
> > generically
> > """
>
> > import toscawidgets.widgets.forms
> > from turbogears.controller import RootController
>
> > formsByTable = {'a':TableForm(id='formA'),
> >          'b':TableForm(id='formB'),
> >          'c':TableForm(id='formC'),
> >         }
>
> > def root(RootController):
>
> >     @expose(...)
> >     def addRecordView(self, tableName **kw):
> >         form = formsByTable[tableName]
> >         return dict(form=form)
>
> >     @expose()
> >     @error_handler(addRecordView)
> >     @myValidate(formsByTable)
> >     def add(self, tableName):
> >         pass
>
> > """
> > The idea here is that my validate function will take the table name
> > from the
> > arglist and generate validation on table provided the lookup to the
> > formsByTable
> > dictionary.
> > """
>
> > #Here is a first-try at the validate function which fails miserably
>
> > def myValidate(forms):
> >     def wrapper(func):
> >         def entangle(self, tableName, **kw):
> >             form=forms[tableName]
> >             validated = validate(form=form)
> >             validated = validated(func)
> >             validated = validated(func, [self, tableName],
> > **kw)
> >             return validated
> >         return entangle
>
> >     return wrapper
>
> > If anyone has any Idea how to do this it would be great for us, and
> > also a bonus to the TG community.  For those of you who have been
> > following on on the dbmechanic deveopment, the project has been moved
> > out of the "pycon" development path on to our own.
>
> > cheers.
> > -chris
>
> --
> Kevin Dangoor
> TurboGears
>
> email: [EMAIL PROTECTED]
> company:http://www.BlazingThings.com
> blog:http://www.BlueSkyOnMars.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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to