def test_actually_reports(self): class RootController(TGController): @expose() def index(self): # Wait for the slow req reporter to report the request. for i in range(100): if 'request' in REPORTED_CONTEXT: break time.sleep(0.01) else: assert False, 'Timeout!' return 'HI' REPORTED_CONTEXT = {} class Reporter(object): def report(self, traceback): REPORTED_CONTEXT.update(traceback.context) cfg = FullStackApplicationConfigurator() cfg.update_blueprint({ 'debug': False, 'trace_slowreqs.enable': True, 'trace_slowreqs.interval': 0, 'trace_slowreqs.reporters': [ Reporter() ], 'root_controller': RootController() }) app = TestApp(cfg.make_wsgi_app({}, {})) assert app.get('/').text == 'HI' assert 'request' in REPORTED_CONTEXT
def test_actually_reports(self): class RootController(TGController): @expose() def index(self): return 1 / 0 REPORTED_CONTEXT = {} class Reporter(object): def report(self, traceback): REPORTED_CONTEXT.update(traceback.context) cfg = FullStackApplicationConfigurator() cfg.update_blueprint({ 'debug': False, 'trace_errors.enable': True, 'trace_errors.reporters': [Reporter()], 'root_controller': RootController() }) app = TestApp(cfg.make_wsgi_app({}, {})) app.get('/', status=404) assert 'request' in REPORTED_CONTEXT
def test_actually_reports(self): class RootController(TGController): @expose() def index(self): return 1/0 REPORTED_CONTEXT = {} class Reporter(object): def report(self, traceback): REPORTED_CONTEXT.update(traceback.context) cfg = FullStackApplicationConfigurator() cfg.update_blueprint({ 'debug': False, 'trace_errors.enable': True, 'trace_errors.reporters': [ Reporter() ], 'root_controller': RootController() }) app = TestApp(cfg.make_wsgi_app({}, {})) app.get('/', status=404) assert 'request' in REPORTED_CONTEXT
# -*- coding: utf-8 -*- """ Global configuration file for TG2-specific settings in jqGrid. This file complements development/deployment.ini. """ from tg import FullStackApplicationConfigurator import jqgrid from jqgrid import model, lib base_config = FullStackApplicationConfigurator() # General configuration base_config.update_blueprint({ # True to prevent dispatcher from striping extensions # For example /socket.io would be served by "socket_io" # method instead of "socket". 'disable_request_extensions': False, # Set None to disable escaping punctuation characters to "_" # when dispatching methods. # Set to a function to provide custom escaping. 'dispatch_path_translator': True, 'package': jqgrid, }) # ToscaWidgets configuration base_config.update_blueprint({ 'tw2.enabled': True,