Ticket #1252 (closed defect: wontfix)

Opened 2 years ago

Last modified 2 months ago

error_handler does not work with python 2.3 [decorator()] syntax

Reported by: corvus Assigned to: alberto
Priority: normal Milestone: 1.0.x bugfix
Component: TurboGears Version: 1.0
Severity: normal Keywords: decorator errorhandling
Cc:

Description

The python 2.3 pseudo-decorator syntax does not work with error_handler. The code:

    [expose(template="sysiphus.templates.results")]
    [validate(form=search_form)]
    [error_handler(index)]
    def search(self, address=''):
        return dict(form=search_form)

produces the error:

...
  File "/usr/lib/python2.3/site-packages/TurboGears-1.0-py2.3.egg/turbogears/controllers.py", line 173, in validate
    return errorhandling.run_with_errors(errors, func, *args, **kw)
  File "/usr/lib/python2.3/site-packages/TurboGears-1.0-py2.3.egg/turbogears/errorhandling.py", line 110, in run_with_errors
    raise NotImplementedError("Method %s.%s() has no applicable "
NotImplementedError: Method Root.search() has no applicable error handler.

But adding the more normal python 2.3 validator syntax:

    search=error_handler(index)(search)

works. In both cases the signature for index is:

    [expose(template="sysiphus.templates.index")]
    def index(self, address='', tg_errors=None):

Change History

01/24/07 09:32:43 changed by alberto

  • owner changed from anonymous to alberto.
  • status changed from new to assigned.

05/01/07 12:56:59 changed by alberto

  • milestone changed from 1.0.2 to 1.0.3.

07/03/07 09:50:18 changed by faide

  • milestone changed from 1.0.3 to 1.1.

12/08/07 07:12:31 changed by Chris Arndt

I think, this is more a documentation issue. If there is an easy workaround/alternative, why bother to fix it?

In TG 1.1 we won't support Python 2.3 any more, anyway.

My suggestion would be to retarget this to TG 1.0.x and make it a documentation issue.

04/10/08 12:29:35 changed by chrisz

  • keywords set to decorator errorhandling.
  • milestone changed from 1.1 to 1.0.x bugfix.

Retargeted to TG 1.0. This really needs to be fixed or documented in 1.0 only. With the Py 2.4 it works, and TG 1.1 support only Py >= 2.4.

08/21/08 22:37:15 changed by Chris Arndt

I added a note about Python 2.3 compatibility to the error_handler documentation.

Can we close this ticket now? There is a workaround and RuleDispatch is replaced in TG 1.1 so I don't think it's worth the effort fixing the cause of this problem.

08/22/08 04:11:04 changed by chrisz

  • status changed from assigned to closed.
  • resolution set to wontfix.

Agreed, closing this now.