On Oct 20, 2006, at 2:13 PM, Sanjay wrote:

>
> Need help on how to pass a parameter to the error_handler function. To
> elaborate my case, giving sample code below.
>
>     @expose(template="demo.templates.form")
>     def display(self, how_to_pass_this_while_catching_exception,
> tg_exceptions=None):
>         if tg_exceptions:
>             turbogears.flash(str("tg_exceptions"))
>         .
>         .
>         .
>
>     @expose()
>     @turbogears.validate(form=form)
>     @turbogears.exception_handler(display)
>     def save(self, **data):
>         .
>         .
>         .
>
> The parameter 'how_to_pass_this_while_catching_exception' is a
> mandatory argument of 'display'. Now, how to pass the argument from  
> the
> 'save' routine, while an exception is caught, is my problem.

You should be able to use turbogears.util.bind_args for that. Say you  
want execution to branch to "display" on an exception and  
"how_to_pass_this_while_catching_exception" being "Foo":

@expose()
@validate(form=form)
@turbogears,exception_handler(bind_args 
(how_to_pass_this_while_catching_exception=Foo)(display))
def save(...):
        ...

HTH,
Alberto

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

Reply via email to