Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #1252 (closed defect: wontfix)

Opened 12 years ago

Last modified 11 years ago

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

Reported by: corvus Owned by: 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

comment:1 Changed 12 years ago by alberto

  • Owner changed from anonymous to alberto
  • Status changed from new to assigned

comment:2 Changed 12 years ago by alberto

  • Milestone changed from 1.0.2 to 1.0.3

comment:3 Changed 12 years ago by faide

  • Milestone changed from 1.0.3 to 1.1

comment:4 Changed 11 years ago 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.

comment:5 Changed 11 years ago by chrisz

  • Keywords decorator errorhandling added
  • 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.

comment:6 Changed 11 years ago 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.

comment:7 Changed 11 years ago by chrisz

  • Status changed from assigned to closed
  • Resolution set to wontfix

Agreed, closing this now.

Note: See TracTickets for help on using tickets.