Hi everyone,
I'm trying to upgrade to TG1.1b3 (b4 is not available in easy_install)
and I have a problem with error reporting.
Based on this page :
http://groups.google.com/group/turbogears/browse_frm/thread/61a48b1f7fdfe354/de325500f437f632?lnk=gst&q=custom+500&rnum=1#de325500f437f632
I did the following :
http://pastebin.com/m7cdf7404
def _cp_on_http_error(self, status, message):
log.exception('%s %s', status, message)
# Make sure response is properly prepared
from cherrypy import _cputil
_cputil._cp_on_http_error(status, message)
# Customize returned page
title = {
400: u'Bad File Request',
401: u'Unauthorized',
403: u'Forbidden/Access Denied',
404: u'File Not Found',
500: u'Internal Error',
501: u'Not Implemented',
502: u'Overload',
}.get(status, message or u'Failure')
import traceback, StringIO
detailsio = StringIO.StringIO()
traceback.print_exc(file = detailsio)
output = dict(
status = status,
message = message or '-',
page_title = title,
admin = 'admin' in identity.current.identity().groups,
url = "%s %s" % (cherrypy.request.method,
cherrypy.request.path),
details = detailsio.getvalue())
template = "cinego.templates.errors"
format = 'html'
content_type = 'text/html'
mapping = None
# Return customized page
body = controllers._process_output(output, template, format,
content_type, mapping)
cherrypy.response.headers['Content-Length'] = len(body)
cherrypy.response.body = body
and this now causes the following error :
Traceback: Traceback (most recent call last):
File "/usr/lib/python2.5/site-packages/CherryPy-2.3.0-py2.5.egg/
cherrypy/_cphttptools.py", line 134, in _run inst.set_response()
File "/usr/lib/python2.5/site-packages/CherryPy-2.3.0-py2.5.egg/
cherrypy/_cperror.py", line 173, in set_response handler(self.status,
self.message)
File "/home/tom/cinego/cinego/controllers.py", line 141, in
_cp_on_http_error content_type, mapping)
File "/usr/lib/python2.5/site-packages/TurboGears-1.1b3-py2.5.egg/
turbogears/controllers.py", line 96, in _process_output
fragment=fragment)
File "/usr/lib/python2.5/site-packages/TurboGears-1.1b3-py2.5.egg/
turbogears/view/base.py", line 194, in render re
Can anyone tell me why this isn't working anymore ?
--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---