On Feb 27, 5:43 pm, "Alex" <[EMAIL PROTECTED]> wrote:
> Doing this however, the form widget can't be used in a validate
> decorator on my save method as it's not in the global scope.
>
> Is there a way to do this so that I can have the benefits of a
> validation decorator and set the defaults from the identity?

Yes, there is :) The form parameter to @validate can be a callable,
which will fetch a form to validate against.

e.g.

def get_form(self):
   form = ...# create/reference complex for form from whatever you
want
   return form

@validate(from=get_form)
def method(self, ...):
   ...


HTH

--
wavy davy


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