Ah, thanks for the help. I put up a quick trac page at
http://trac.turbogears.org/turbogears/wiki/ErrorReporting. There was one other
bug in your code, the
controller method takes one more parameter: (self, tg_source, tg_errors,
tg_exception)
Cheers
-Rob
Simon Belak wrote:
> Robin Haswell wrote:
>>> 2) define a catch-all exception handler:
>>>
>>> @dispatch_error.when("tg_exception is not None")
>>> def notify(self, tg_source, tg_exception):
>>> return "Holly exception Batman!"
>> Cheers, I think I'll go for this option, but it doesn't seem to work
>> properly. Have I done something
>> wrong?
>>
>> [EMAIL PROTECTED]:~/obb$ ./start-obb.py
>> Traceback (most recent call last):
>> File "./start-obb.py", line 26, in ?
>> from obb.controllers import Root
>> File "/home/rob/obb/obb/controllers.py", line 33, in ?
>> class Game(controllers.RootController):
>> File "/home/rob/obb/obb/controllers.py", line 350, in Game
>> @turbogears.errorhandling.dispatch_error.when("tg_exception is not
>> None")
>> File
>> "/usr/local/lib/python2.4/site-packages/TurboGears-0.9a5-py2.4.egg/turbogears/genericfunctions.py",
>>
>> line 20, in when
>> return self._decorate(cond, "primary%d" % order)
>> File "build/bdist.linux-i686/egg/dispatch/functions.py", line 577, in
>> _decorate
>> File "<string>", line 10, in parseRule
>> File "build/bdist.linux-i686/egg/dispatch/functions.py", line 440, in
>> parseRule
>> File "build/bdist.linux-i686/egg/dispatch/functions.py", line 326, in
>> parse
>> File "build/bdist.linux-i686/egg/dispatch/ast_builder.py", line 383, in
>> parse_expr
>> File "build/bdist.linux-i686/egg/dispatch/ast_builder.py", line 378, in
>> build
>> File "build/bdist.linux-i686/egg/dispatch/ast_builder.py", line 111, in
>> comparison
>> File "build/bdist.linux-i686/egg/dispatch/predicates.py", line 576, in
>> Compare
>> File "build/bdist.linux-i686/egg/dispatch/ast_builder.py", line 378, in
>> build
>> File "build/bdist.linux-i686/egg/dispatch/ast_builder.py", line 10, in
>> <lambda>
>> File "build/bdist.linux-i686/egg/dispatch/predicates.py", line 58, in Name
>> NameError: tg_exception
>
> Sorry, I gave you the wrong name, in 0.9 (and 1.0) it's tg_exceptions
> (plural).
>
>> Perhaps this is related to my broken .9a1->.9a5 project? I intend to fix it
>> up soon, but I currently
>> get these errors all over the bloody place (although never on startup, only
>> on shutdown or page load):
>>
>> 2006-05-07 20:58:07,831 cherrypy.msg INFO HTTP: Serving HTTP on
>> http://localhost:8080/
>> 2006-05-07 20:58:11,723 cherrypy.msg INFO ENGINE: <Ctrl-C> hit: shutting
>> down autoreloader
>> 2006-05-07 20:58:11,763 cherrypy.msg INFO HTTP: HTTP Server shut down
>> 2006-05-07 20:58:11,823 turbogears.visit INFO Visit Tracking shutting down
>> 2006-05-07 20:58:11,864 turbogears.identity INFO Identity shutting down
>> 2006-05-07 20:58:11,865 cherrypy.msg INFO ENGINE: CherryPy shut down
>> Error in atexit._run_exitfuncs:
>> Traceback (most recent call last):
>> File "/usr/lib/python2.4/atexit.py", line 24, in _run_exitfuncs
>> func(*targs, **kargs)
>> File "/usr/lib/python2.4/logging/__init__.py", line 1332, in shutdown
>> h.flush()
>> File "/usr/lib/python2.4/logging/__init__.py", line 718, in flush
>> self.stream.flush()
>> AttributeError: 'str' object has no attribute 'flush'
>> Error in sys.exitfunc:
>> Traceback (most recent call last):
>> File "/usr/lib/python2.4/atexit.py", line 24, in _run_exitfuncs
>> func(*targs, **kargs)
>> File "/usr/lib/python2.4/logging/__init__.py", line 1332, in shutdown
>> h.flush()
>> File "/usr/lib/python2.4/logging/__init__.py", line 718, in flush
>> self.stream.flush()
>> AttributeError: 'str' object has no attribute 'flush'
>>
>> I think it's related to having no logging directives or anything.
>>
>> When I get this running I think a trac page is definitely in order.
>
> This is probably due to changes in logging facilites [1].
>
> Cheers,
> Simon
>
> [1]
> http://groups.google.com/group/turbogears-trunk/browse_thread/thread/501a6e4e5c952cfc/7049312e45cf4281
>
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~----------~----~----~----~------~----~------~--~---