import pylons from paste.deploy.converters import asbool from pylons.error import template_error_formatters from weberror.evalexception import EvalException from weberror.errormiddleware import ErrorMiddleware media_path = pylons.middleware.media_path report_libs = pylons.middleware.report_libs if 'tg.devtools' not in report_libs: report_libs.extend(['tg.devtools']) header_html = pylons.middleware.head_html footer_html = """\

TurboGears Online Assistance

 

Looking for help?

Here are a few tips for troubleshooting if the above traceback isn't helping out.

  1. Search the mail list
  2. Post the traceback, and ask for help on IRC
  3. Post a message to the mail list, referring to the posted traceback

Note: Clicking this button will post your traceback to the PylonsHQ website. The traceback includes the module names, Python version, and lines of code that you can see above. All tracebacks are posted anonymously unless you're logged into the PylonsHQ website in this browser.

The following mail lists will be searched:
Python
Pylons
TurboGears
SQLAlchemy
Genshi
ToscaWidgets
Mako
SQLAlchemy

for:

Pylons version %s
""" def ErrorHandler(app, global_conf, **errorware): """ErrorHandler Toggle If debug is enabled, this function will return the app wrapped in the WebError ``EvalException`` middleware which displays interactive debugging sessions when a traceback occurs. Otherwise, the app will be wrapped in the WebError ``ErrorMiddleware``, and the ``errorware`` dict will be passed into it. The ``ErrorMiddleware`` handles sending an email to the address listed in the .ini file, under ``email_to``. """ if asbool(global_conf.get('debug')): footer = footer_html % (pylons.config.get('traceback_host', 'beta.pylonshq.com'), pylons.__version__) py_media = dict(pylons=media_path) app = EvalException(app, global_conf, templating_formatters=template_error_formatters, media_paths=py_media, head_html=header_html, footer_html=footer, libraries=report_libs) else: app = ErrorMiddleware(app, global_conf, **errorware) return app