If I create the following TG app

class Root(controllers.Root):
        @turbogears.expose()
        def index(self):
                1/0

It results in this stack trace:

Page handler: <bound method Root.index of <comments.controllers.Root object at 
0x408f966c>>
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 index
  File 
"/usr/lib/python2.4/site-packages/TurboGears-0.9a0dev_r648-py2.4.egg/turbogears/controllers.py",
 line 218, in expose
    func, tg_format, html, fragment, *args, **kw)
  File 
"/usr/lib/python2.4/site-packages/TurboGears-0.9a0dev_r648-py2.4.egg/turbogears/database.py",
 line 193, in run_with_transaction
    retval = func(*args, **kw)
  File 
"/usr/lib/python2.4/site-packages/TurboGears-0.9a0dev_r648-py2.4.egg/turbogears/controllers.py",
 line 248, in _execute_func
    output = dispatch_error(func, self, *args, **kw)
  File "<string>", line 5, in dispatch_error
  File 
"/usr/lib/python2.4/site-packages/TurboGears-0.9a0dev_r648-py2.4.egg/turbogears/controllers.py",
 line 300, in _default_error_handler
    return getattr(self, error_source.__name__ )(*args, **kw)
  File "<string>", line 3, in index
  File 
"/usr/lib/python2.4/site-packages/TurboGears-0.9a0dev_r648-py2.4.egg/turbogears/controllers.py",
 line 214, in expose
    output = _execute_func(self, func, tg_format, html, fragment, *args, **kw)
  File 
"/usr/lib/python2.4/site-packages/TurboGears-0.9a0dev_r648-py2.4.egg/turbogears/controllers.py",
 line 245, in _execute_func
    raise error
ZeroDivisionError: integer division or modulo by zero


I'm not seeing where in that stack trace it tells me where the exception
actually came from :(.  The only mention of my code that I see is "bound
method Root.index of <comments.controllers.Root object>" which doesn't
always narrow it down much. The above example is contrived to illustrate
the point, obviously, but I'm having a hard time seeing how I'm supposed
to debug exceptions when the normal python stack trace has been taken
away from me :-/

Reply via email to