Thanks for replying to my question Christoph, 
I did exactly as you said but it doesn't work yet....
Using pdb I can see that request.error_response has handle_errror() 
assigned to,
before the error 500, but then it changes again, and I don't know where and 
what changes it, 
take a look  ...

....debugging my controller...
import pdb;pdb.set_trace()
(Pdb) cherrypy.request.error_response.func_name
'handle_error'
           ### as you see at this point request.error_response has indeed 
the handle_error assigned to
(Pdb) c
*raise* SyntaxError*(*'test error 500'*)*

-------and now lets see the value of request.error_response in the 
traceback ...

URL: http://mysite/specie/
Module paste.evalexception.middleware:*306* in respond         
<http://josedev:8001/specie/#>
>>  <http://josedev:8001/specie/#>app_iter *=* self*.*application*(*environ
*,* detect_start_response*)*
Module cherrypy._cpwsgi:*380* in tail         <http://josedev:8001/specie/#>
>>  <http://josedev:8001/specie/#>*return* self*.*response_class*(*environ
*,* start_response*,* self*.*cpapp*)*
Module cherrypy._cpwsgi:*222* in __init__         
<http://josedev:8001/specie/#>
>>  <http://josedev:8001/specie/#>self*.*run*(**)*
Module cherrypy._cpwsgi:*320* in run         <http://josedev:8001/specie/#>
>>  <http://josedev:8001/specie/#>request*.*run*(*meth*,* path*,* qs*,* 
rproto*,* headers*,* rfile*)*
Module cherrypy._cprequest:*575* in run         
<http://josedev:8001/specie/#>
>>  <http://josedev:8001/specie/#>self*.*respond*(*pi*)*
Module cherrypy._cprequest:*656* in respond         
<http://josedev:8001/specie/#>
>>  <http://josedev:8001/specie/#>response*.*body *=* self*.*handler*(**)*
Module cherrypy._cpdispatch:*34* in __call__         
<http://josedev:8001/specie/#>
>>  <http://josedev:8001/specie/#>*return* self*.*callable*(****self*.*args
*,* ****self*.*kwargs*)*
Module ?:*3* in index         <http://josedev:8001/specie/#>
Module turbogears.identity.conditions:*235* in require         
<http://josedev:8001/specie/#>
>>  <http://josedev:8001/specie/#>*return* fn*(*self*,* ***args*,* ****
kwargs*)*
Module ?:*3* in index         <http://josedev:8001/specie/#>
Module turbogears.controllers:*360* in expose         
<http://josedev:8001/specie/#>
>>  <http://josedev:8001/specie/#>***args*,* ****kw*)*
Module turbogears.database:*422* in run_with_transaction         
<http://josedev:8001/specie/#>
>>  <http://josedev:8001/specie/#>*@**abstract**(**)*
Module turbogears.database:*?* in run_with_transaction         
<http://josedev:8001/specie/#>
Module turbogears.database:*495* in sa_rwt         
<http://josedev:8001/specie/#>
>>  <http://josedev:8001/specie/#>retval *=* func*(****args*,* ****kw*)*
Module turbogears.controllers:*244* in _expose         
<http://josedev:8001/specie/#>
>>  <http://josedev:8001/specie/#>*@**abstract**(**)*
Module turbogears.controllers:*?* in _expose         
<http://josedev:8001/specie/#>
Module turbogears.controllers:*389* in <lambda>         
<http://josedev:8001/specie/#>
>>  <http://josedev:8001/specie/#>fragment*,* options*,* args*,* kw*)**)**)*
Module turbogears.controllers:*425* in _execute_func         
<http://josedev:8001/specie/#>
>>  <http://josedev:8001/specie/#>output *=* errorhandling*.*try_call*(*func
*,* ***args*,* ****kw*)*
Module turbogears.errorhandling:*82* in try_call         
<http://josedev:8001/specie/#>
>>  <http://josedev:8001/specie/#>*return* func*(*self*,* ***args*,* ****kw
*)*
Module sicer.BASE.controller.tabelleCodifica.specie:*79* in index         
<http://josedev:8001/specie/#>
 >>> cherrypy*.*request*.*error_response
<bound method HTTPError.set_response of HTTPError(500, None)>

>>> cherrypy*.*request*.*error_response*.*func_name
'set_response'

 *cherrypy*<module 'cherrypy' from 
'../buildout/eggs/CherryPy-3.2.4-py2.6.egg/cherrypy/__init... 
<http://josedev:8001/specie/#>
*data*{}

*pdb*<module 'pdb' from '../buildout/parts/python2.6/lib/python2.6/pdb.pyc'>
*self*<..controller.specie.Controller object at 0xc1d8a90>

>>  <http://josedev:8001/specie/#>*raise* SyntaxError*(*'test error 500'*)*
*SyntaxError: test error 500*

Il giorno venerdì 22 agosto 2014 22:26:11 UTC+2, Christoph Zwerschke ha 
scritto:
>
> Am 22.08.2014 um 10:54 schrieb Jose Soares: 
> > After having carefully read the documentation at 
> > http://www.turbogears.org/1.5/docs/ErrorReporting.html 
> > I decided to use "Method 3: Application-wide Catch-all with 
> error_response" 
> > Then, I wrote the following code in my controller: 
>
> Hi Jose, 
>
> your code is different from what is written in the docs. Particularly, 
> the handle_error() should be taken literally from there. 
>
> Just copy the code in the docs into a module errorhandling.py, then add 
>
> from .errorhandling import error_page, handle_error 
>
> at the top of your project, and add this to your RootController class: 
>
>      if config.get('error_catcher.on', False): 
>          _cp_config = { 
>              'error_page.default': error_page, 
>              'request.error_response': handle_error 
>          } 
>
> That definitely works for me, inculding the 500 errors. 
>
> -- Christoph 
>

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/turbogears.
For more options, visit https://groups.google.com/d/optout.

Reply via email to