Jorge Godoy wrote:

I was getting the following traceback when an error occurs in a validator in
my siteamostras.materiais module:

================================================================================
Traceback (most recent call last):
  File 
"/usr/lib/python2.4/site-packages/CherryPy-2.2.0beta-py2.4.egg/cherrypy/_cphttptools.py",
 line 99, in _run
    self.main()
  File 
"/usr/lib/python2.4/site-packages/CherryPy-2.2.0beta-py2.4.egg/cherrypy/_cphttptools.py",
 line 247, in main
    body = page_handler(*virtual_path, **self.params)
  File "<string>", line 3, in update
  File 
"/home/godoy/desenvolvimento/python/TurboGears/trunk/turbogears/controllers.py",
 line 198, in expose
    func, tg_format, html, fragment, *args, **kw)
  File 
"/home/godoy/desenvolvimento/python/TurboGears/trunk/turbogears/database.py", 
line 193, in run_with_transaction
    retval = func(*args, **kw)
  File 
"/home/godoy/desenvolvimento/python/TurboGears/trunk/turbogears/controllers.py",
 line 215, in _execute_func
    output = errorhandling.try_call(func, self, *args, **kw)
  File 
"/home/godoy/desenvolvimento/python/TurboGears/trunk/turbogears/errorhandling.py",
 line 62, in try_call
    output = func(self, *args, **kw)
  File "<string>", line 3, in update
  File 
"/home/godoy/desenvolvimento/python/TurboGears/trunk/turbogears/controllers.py",
 line 134, in validate
    return errorhandling.run_with_errors(errors, func, self, *args, **kw)
  File 
"/home/godoy/desenvolvimento/python/TurboGears/trunk/turbogears/errorhandling.py",
 line 93, in run_with_errors
    output = dispatch_error(func, self, errors, None, *args, **kw)
  File "<string>", line 5, in dispatch_error
  File "_speedups.pyx", line 376, in _speedups.BaseDispatcher.__getitem__
  File "build/bdist.linux-i686/egg/dispatch/interfaces.py", line 15, in __call__
AmbiguousMethod: ([(Signature((2, <class 'dispatch.strategy.Node'>)=TruthCriterion(True),(10, <class 
'dispatch.strategy.Node'>)=TruthCriterion(True)), <function _implicit_error_handler at 0x40940ed4>), (Signature((13, <class 
'dispatch.strategy.node_type'>)=Inequality("..",(('update', 'update'),)),(2, <class 
'dispatch.strategy.Node'>)=TruthCriterion(True),(0, <class 'dispatch.strategy.Node'>)=function), <function adaptor at 0x40d1210c>)], 
(<function update at 0x40d3bd4c>, <siteamostras.materiais.Materiais instance at 0x40d4fbcc>, {'custo_nao_devolvido': 
<formencode.api.Invalid instance at 0x417f6dec>}, None, (3,), {'custo_devolvido': 123.93000000000001, 'custo_nao_devolvido': 'abc', 
'descricao': 'teste3'}), {})
================================================================================

The problem is that I was using tg_errors attribute syntax in this module but
the decorator syntax in my siteamostras.equipamentos module.  If I mix
decorator + attribute syntax even in different modules, this happens.  I've
switched all my code to use the attribute syntax since I can have a better
control here.

I believe there's some 'leak' or something that isn't safe happening that is
mixing error handlers.


Interesting. Would you mind trying with r763+.

Thanks,
Simon

P.S. I feel really bad, you seem to be the one to stumble into my every mistake. Hope it's not taxing your work to much.

Reply via email to