##// END OF EJS Templates
appenligth: make it optional if library is not installed
super-admin -
r4937:08819a6d default
parent child Browse files
Show More
@@ -25,18 +25,10 b' import logging'
25
25
26 log = logging.getLogger(__name__)
26 log = logging.getLogger(__name__)
27
27
28 appenlight_installed = False
29
30 try:
31 from appenlight_client import make_appenlight_middleware
32 from appenlight_client.exceptions import get_current_traceback
33 from appenlight_client.wsgi import AppenlightWSGIWrapper
34 appenlight_installed = True
35 except ImportError:
36 log.info('Appenlight packages not present, skipping appenlight setup')
37
38
28
39 def track_exception(environ):
29 def track_exception(environ):
30 from appenlight_client.exceptions import get_current_traceback
31
40 if 'appenlight.client' not in environ:
32 if 'appenlight.client' not in environ:
41 return
33 return
42
34
@@ -44,7 +36,8 b' def track_exception(environ):'
44 environ['appenlight.__traceback'] = get_current_traceback(
36 environ['appenlight.__traceback'] = get_current_traceback(
45 skip=1,
37 skip=1,
46 show_hidden_frames=True,
38 show_hidden_frames=True,
47 ignore_system_exceptions=True)
39 ignore_system_exceptions=True
40 )
48
41
49
42
50 def track_extra_information(environ, section, value):
43 def track_extra_information(environ, section, value):
@@ -72,13 +65,21 b' def wrap_in_appenlight_if_enabled(app, s'
72 This is in use to support our setup of the vcs related middlewares.
65 This is in use to support our setup of the vcs related middlewares.
73
66
74 """
67 """
75 if appenlight_installed and settings['appenlight']:
68 if settings['appenlight']:
69 try:
70 from appenlight_client import make_appenlight_middleware
71 from appenlight_client.wsgi import AppenlightWSGIWrapper
72 except ImportError:
73 log.info('Appenlight packages not present, skipping appenlight setup')
74 return app, appenlight_client
75
76 app = RemoteTracebackTracker(app)
76 app = RemoteTracebackTracker(app)
77 if not appenlight_client:
77 if not appenlight_client:
78 app = make_appenlight_middleware(app, settings)
78 app = make_appenlight_middleware(app, settings)
79 appenlight_client = app.appenlight_client
79 appenlight_client = app.appenlight_client
80 else:
80 else:
81 app = AppenlightWSGIWrapper(app, appenlight_client)
81 app = AppenlightWSGIWrapper(app, appenlight_client)
82
82 return app, appenlight_client
83 return app, appenlight_client
83
84
84
85
General Comments 0
You need to be logged in to leave comments. Login now