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