I'm generally supportive of adding these to the core, but I'd like a
bit of an explantion of what they are used for.   If that
documentation goes in at the same time as the decorators, I'm +1 on
this.

--Mark

On Wed, Jan 14, 2009 at 1:13 PM, percious <[email protected]> wrote:
>
> Hey guys.
>
> I've been working quite a bit with some of the new functionality in
> TG2, but even then I have found a couple of needs.  I am providing
> these decorators for your review:  http://tinyurl.com/new-tg2-decorators
> I would like these to be included in the core of TG, but not without
> some review first.
>
> @catch_errors
> Catches errors and displays them with tg_flash
>
> @registered_validate
> Allows you to register a validator on the controller instance so that
> you can change the forms used for each controller instance.  This is
> especially useful with TG2's new lookup cababilities.
>
> register_validators()
> Helper function which sets the lookup for the controller.
>
> For @registered_validate I would like to move the implementation
> directly into the DecoratedController class so that you would do
> something like:
>
>    >>> class MyController(TGController):
>    >>>
>    >>>     def __init__(self, params):
>    >>>         self.form = MyForm(params)
>    >>>         self.register_validators('eval_form', self.form)
>    >>>
>    >>>     @expose('myproject.templates.error_handler')
>    >>>     def render_form(self):
>    >>>         pylons.c.form = self.form
>    >>>         return
>    >>>
>    >>>     @validate(error_handler=render_form)
>    >>>     @expose()
>    >>>     def eval_form(self):
>    >>>         raise Exception
>
> and use the existing @validate decorator.  This would eliminate
> confusion about what validator is needed when.
>
> So let me know if/how you would like inclusion of this functionality
> in TG2.  I'd like to have it in for b3.
>
> cheers.
> -chris
> >

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears Trunk" 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-trunk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to