backlash 0.3.0__tar.gz → 0.3.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. backlash-0.3.2/AUTHORS +15 -0
  2. backlash-0.3.2/PKG-INFO +138 -0
  3. {backlash-0.3.0 → backlash-0.3.2}/backlash/_compat.py +1 -0
  4. {backlash-0.3.0 → backlash-0.3.2}/backlash/tbtools.py +3 -1
  5. {backlash-0.3.0 → backlash-0.3.2}/backlash/tracing/slowrequests/middleware.py +1 -1
  6. backlash-0.3.2/backlash.egg-info/PKG-INFO +138 -0
  7. {backlash-0.3.0 → backlash-0.3.2}/backlash.egg-info/SOURCES.txt +1 -0
  8. {backlash-0.3.0 → backlash-0.3.2}/setup.py +1 -1
  9. backlash-0.3.0/PKG-INFO +0 -134
  10. backlash-0.3.0/backlash.egg-info/PKG-INFO +0 -134
  11. {backlash-0.3.0 → backlash-0.3.2}/LICENSE +0 -0
  12. {backlash-0.3.0 → backlash-0.3.2}/MANIFEST.in +0 -0
  13. {backlash-0.3.0 → backlash-0.3.2}/README.rst +0 -0
  14. {backlash-0.3.0 → backlash-0.3.2}/backlash/__init__.py +0 -0
  15. {backlash-0.3.0 → backlash-0.3.2}/backlash/console.py +0 -0
  16. {backlash-0.3.0 → backlash-0.3.2}/backlash/debug.py +0 -0
  17. {backlash-0.3.0 → backlash-0.3.2}/backlash/frtools.py +0 -0
  18. {backlash-0.3.0 → backlash-0.3.2}/backlash/repr.py +0 -0
  19. {backlash-0.3.0 → backlash-0.3.2}/backlash/statics/FONT_LICENSE +0 -0
  20. {backlash-0.3.0 → backlash-0.3.2}/backlash/statics/console.png +0 -0
  21. {backlash-0.3.0 → backlash-0.3.2}/backlash/statics/debugger.js +0 -0
  22. {backlash-0.3.0 → backlash-0.3.2}/backlash/statics/jquery.js +0 -0
  23. {backlash-0.3.0 → backlash-0.3.2}/backlash/statics/less.png +0 -0
  24. {backlash-0.3.0 → backlash-0.3.2}/backlash/statics/more.png +0 -0
  25. {backlash-0.3.0 → backlash-0.3.2}/backlash/statics/opensans.ttf +0 -0
  26. {backlash-0.3.0 → backlash-0.3.2}/backlash/statics/source.png +0 -0
  27. {backlash-0.3.0 → backlash-0.3.2}/backlash/statics/style.css +0 -0
  28. {backlash-0.3.0 → backlash-0.3.2}/backlash/trace_errors/__init__.py +0 -0
  29. {backlash-0.3.0 → backlash-0.3.2}/backlash/trace_errors/sentry.py +0 -0
  30. {backlash-0.3.0 → backlash-0.3.2}/backlash/tracing/__init__.py +0 -0
  31. {backlash-0.3.0 → backlash-0.3.2}/backlash/tracing/errors/__init__.py +0 -0
  32. {backlash-0.3.0 → backlash-0.3.2}/backlash/tracing/errors/middleware.py +0 -0
  33. {backlash-0.3.0 → backlash-0.3.2}/backlash/tracing/reporters/__init__.py +0 -0
  34. {backlash-0.3.0 → backlash-0.3.2}/backlash/tracing/reporters/mail.py +0 -0
  35. {backlash-0.3.0 → backlash-0.3.2}/backlash/tracing/reporters/sentry.py +0 -0
  36. {backlash-0.3.0 → backlash-0.3.2}/backlash/tracing/slowrequests/__init__.py +0 -0
  37. {backlash-0.3.0 → backlash-0.3.2}/backlash/tracing/slowrequests/timer.py +0 -0
  38. {backlash-0.3.0 → backlash-0.3.2}/backlash/utils.py +0 -0
  39. {backlash-0.3.0 → backlash-0.3.2}/backlash.egg-info/dependency_links.txt +0 -0
  40. {backlash-0.3.0 → backlash-0.3.2}/backlash.egg-info/entry_points.txt +0 -0
  41. {backlash-0.3.0 → backlash-0.3.2}/backlash.egg-info/not-zip-safe +0 -0
  42. {backlash-0.3.0 → backlash-0.3.2}/backlash.egg-info/requires.txt +0 -0
  43. {backlash-0.3.0 → backlash-0.3.2}/backlash.egg-info/top_level.txt +0 -0
  44. {backlash-0.3.0 → backlash-0.3.2}/setup.cfg +0 -0
backlash-0.3.2/AUTHORS ADDED
@@ -0,0 +1,15 @@
1
+ Backlash is written and maintained by the TurboGears Team and various contributors:
2
+
3
+
4
+ Project Core Developers:
5
+
6
+ Alessandro Molina <amol@turbogears.org>
7
+
8
+
9
+ Contributions:
10
+
11
+
12
+ The tbtools module and the stylesheet are taken from the Werkzeug project
13
+ which is originally licensed under the BSD license, please refer to
14
+ the AUTHORS file of the Werkzeug project for additional informations on its
15
+ contributors.
@@ -0,0 +1,138 @@
1
+ Metadata-Version: 2.1
2
+ Name: backlash
3
+ Version: 0.3.2
4
+ Summary: Standalone WebOb port of the Werkzeug Debugger with Python3 support meant to replace WebError in future TurboGears2
5
+ Home-page: https://github.com/TurboGears/backlash
6
+ Author: Alessandro Molina
7
+ Author-email: amol@turbogears.org
8
+ License: MIT
9
+ Keywords: wsgi
10
+ Platform: UNKNOWN
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Programming Language :: Python
14
+ Classifier: Programming Language :: Python :: 2.7
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Topic :: Internet :: WWW/HTTP :: WSGI :: Middleware
17
+ Classifier: Topic :: Internet :: WWW/HTTP :: WSGI
18
+ License-File: LICENSE
19
+ License-File: AUTHORS
20
+
21
+ About backlash
22
+ -------------------------
23
+
24
+ backlash is a swiss army knife for web applications debugging, which provides:
25
+
26
+ - An Interactive In Browser Debugger based on a Werkzeug Debugger fork ported to WebOb
27
+ - Crash reporting by email and on Sentry
28
+ - Slow requests reporting by email and on Sentry.
29
+
30
+ Backlash was born as a replacement for WebError in TurboGears2.3 versions.
31
+
32
+ Installing
33
+ -------------------------------
34
+
35
+ backlash can be installed from pypi::
36
+
37
+ pip install backlash
38
+
39
+ should just work for most of the users
40
+
41
+ Debugging and Console
42
+ ----------------------------------
43
+
44
+ Backlash supports both debugging applications on crash and realtime console,
45
+ both are based on the Werkzeug Debugger and adapted to work with WebOb.
46
+
47
+ The debugging function is provided by the ``DebuggedApplication`` middleware,
48
+ wrapping your application with this middleware will intercept any exception
49
+ and display the traceback and an interactive console in your browser.
50
+
51
+ An interactive console will also be always available at ``/__console__`` path.
52
+
53
+ Context Injectors
54
+ +++++++++++++++++++++++++++++
55
+
56
+ The ``DebuggedApplication`` middleware also makes possible to provide one or more
57
+ ``context injectors``, those are simple python functions that will be called when
58
+ an exception is raised to retrieve the context to store and make back available during
59
+ debugging.
60
+
61
+ Context injectors have to return a dictionary which will be merged into the current
62
+ request context, the request context itself will be made available inside the debugger
63
+ as the ``ctx`` object.
64
+
65
+ This feature is used for example by TurboGears to provide back some of the objects
66
+ which were available during execution like the current request.
67
+
68
+ Example
69
+ +++++++++++++++++++++++++++++++
70
+
71
+ The DebuggedApplication middleware is used by TurboGears in the following way::
72
+
73
+ def _turbogears_backlash_context(environ):
74
+ tgl = environ.get('tg.locals')
75
+ return {'request':getattr(tgl, 'request', None)}
76
+
77
+ app = backlash.DebuggedApplication(app, context_injectors=[_turbogears_backlash_context])
78
+
79
+
80
+ Exception Tracing
81
+ ---------------------------------------
82
+
83
+ The ``TraceErrorsMiddleware`` provides a WSGI middleware that intercepts any exception
84
+ raised during execution, retrieves a traceback object and provides it to one or more
85
+ ``reporters`` to log the error.
86
+
87
+ By default the ``EmailReporter`` and ``SentryReporter`` are provided to send error
88
+ reports by email and on Sentry.
89
+
90
+ The ``EmailReporter`` supports most of the options WebError ErrorMiddleware to provide some
91
+ kind of backward compatibility and make possible a quick transition.
92
+
93
+ While this function is easily replicable using the python logging SMTPHandler, the
94
+ TraceErrorsMiddleware is explicitly meant for web applications crash reporting
95
+ which has the benefit of being able to provide more complete information and keep a clear
96
+ and separate process in managing errors.
97
+
98
+ Example
99
+ ++++++++++++++++++++++++++++++++
100
+
101
+ The TraceErrorsMiddleware is used by TurboGears in the following way::
102
+
103
+ from backlash.trace_errors import EmailReporter
104
+
105
+ def _turbogears_backlash_context(environ):
106
+ tgl = environ.get('tg.locals')
107
+ return {'request':getattr(tgl, 'request', None)}
108
+
109
+ app = backlash.TraceErrorsMiddleware(app, [EmailReporter(**errorware)],
110
+ context_injectors=[_turbogears_backlash_context])
111
+
112
+ Slow Requests Tracing
113
+ ---------------------------------------
114
+
115
+ The ``TraceSlowRequestsMiddleware`` provides a WSGI middleware that tracks requests
116
+ execution time and reports requests that took more than a specified interval to complete
117
+ (by default 25 seconds).
118
+
119
+ It is also possible to exclude a list of paths that start with a specified string
120
+ to avoid reporting long polling connections or other kind of requests that are
121
+ expected to have a long life spawn.
122
+
123
+ Example
124
+ ++++++++++++++++++++++++++++++++
125
+
126
+ The TraceSlowRequestsMiddleware is used by TurboGears in the following way::
127
+
128
+ from backlash.trace_errors import EmailReporter
129
+
130
+ def _turbogears_backlash_context(environ):
131
+ tgl = environ.get('tg.locals')
132
+ return {'request':getattr(tgl, 'request', None)}
133
+
134
+ app = backlash.TraceSlowRequestsMiddleware(app, [EmailReporter(**errorware)],
135
+ interval=25, exclude_paths=None,
136
+ context_injectors=[_turbogears_backlash_context])
137
+
138
+
@@ -3,6 +3,7 @@ import types
3
3
 
4
4
  # True if we are running on Python 3.
5
5
  PY3 = sys.version_info[0] == 3
6
+ PY2 = sys.version_info[0] == 2
6
7
 
7
8
  if PY3: # pragma: no cover
8
9
  string_types = str,
@@ -20,7 +20,7 @@ from tokenize import TokenError
20
20
  from backlash.utils import escape
21
21
  from backlash.console import Console
22
22
 
23
- from backlash._compat import text_, native_, string_types, text_type, exec_, urlopen
23
+ from backlash._compat import PY2, text_, native_, string_types, text_type, exec_, urlopen
24
24
 
25
25
  _coding_re = re.compile(r'coding[:=]\s*([-\w.]+)')
26
26
  _line_re = re.compile(r'^(.*?)$', re.MULTILINE)
@@ -264,6 +264,8 @@ class Traceback(object):
264
264
  if logfile is None:
265
265
  logfile = sys.stderr
266
266
  tb = self.plaintext.rstrip() + '\n'
267
+ if PY2:
268
+ tb = tb.encode('utf-8')
267
269
  logfile.write(tb)
268
270
 
269
271
  def paste(self):
@@ -22,7 +22,7 @@ class TraceSlowRequestsMiddleware(object):
22
22
  self.exclude_paths = exclude_paths or []
23
23
 
24
24
  self.timer = Timer()
25
- self.timer.setDaemon(True)
25
+ self.timer.daemon = True
26
26
  self.timer.start()
27
27
 
28
28
  def _stream_response(self, environ, data):
@@ -0,0 +1,138 @@
1
+ Metadata-Version: 2.1
2
+ Name: backlash
3
+ Version: 0.3.2
4
+ Summary: Standalone WebOb port of the Werkzeug Debugger with Python3 support meant to replace WebError in future TurboGears2
5
+ Home-page: https://github.com/TurboGears/backlash
6
+ Author: Alessandro Molina
7
+ Author-email: amol@turbogears.org
8
+ License: MIT
9
+ Keywords: wsgi
10
+ Platform: UNKNOWN
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Programming Language :: Python
14
+ Classifier: Programming Language :: Python :: 2.7
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Topic :: Internet :: WWW/HTTP :: WSGI :: Middleware
17
+ Classifier: Topic :: Internet :: WWW/HTTP :: WSGI
18
+ License-File: LICENSE
19
+ License-File: AUTHORS
20
+
21
+ About backlash
22
+ -------------------------
23
+
24
+ backlash is a swiss army knife for web applications debugging, which provides:
25
+
26
+ - An Interactive In Browser Debugger based on a Werkzeug Debugger fork ported to WebOb
27
+ - Crash reporting by email and on Sentry
28
+ - Slow requests reporting by email and on Sentry.
29
+
30
+ Backlash was born as a replacement for WebError in TurboGears2.3 versions.
31
+
32
+ Installing
33
+ -------------------------------
34
+
35
+ backlash can be installed from pypi::
36
+
37
+ pip install backlash
38
+
39
+ should just work for most of the users
40
+
41
+ Debugging and Console
42
+ ----------------------------------
43
+
44
+ Backlash supports both debugging applications on crash and realtime console,
45
+ both are based on the Werkzeug Debugger and adapted to work with WebOb.
46
+
47
+ The debugging function is provided by the ``DebuggedApplication`` middleware,
48
+ wrapping your application with this middleware will intercept any exception
49
+ and display the traceback and an interactive console in your browser.
50
+
51
+ An interactive console will also be always available at ``/__console__`` path.
52
+
53
+ Context Injectors
54
+ +++++++++++++++++++++++++++++
55
+
56
+ The ``DebuggedApplication`` middleware also makes possible to provide one or more
57
+ ``context injectors``, those are simple python functions that will be called when
58
+ an exception is raised to retrieve the context to store and make back available during
59
+ debugging.
60
+
61
+ Context injectors have to return a dictionary which will be merged into the current
62
+ request context, the request context itself will be made available inside the debugger
63
+ as the ``ctx`` object.
64
+
65
+ This feature is used for example by TurboGears to provide back some of the objects
66
+ which were available during execution like the current request.
67
+
68
+ Example
69
+ +++++++++++++++++++++++++++++++
70
+
71
+ The DebuggedApplication middleware is used by TurboGears in the following way::
72
+
73
+ def _turbogears_backlash_context(environ):
74
+ tgl = environ.get('tg.locals')
75
+ return {'request':getattr(tgl, 'request', None)}
76
+
77
+ app = backlash.DebuggedApplication(app, context_injectors=[_turbogears_backlash_context])
78
+
79
+
80
+ Exception Tracing
81
+ ---------------------------------------
82
+
83
+ The ``TraceErrorsMiddleware`` provides a WSGI middleware that intercepts any exception
84
+ raised during execution, retrieves a traceback object and provides it to one or more
85
+ ``reporters`` to log the error.
86
+
87
+ By default the ``EmailReporter`` and ``SentryReporter`` are provided to send error
88
+ reports by email and on Sentry.
89
+
90
+ The ``EmailReporter`` supports most of the options WebError ErrorMiddleware to provide some
91
+ kind of backward compatibility and make possible a quick transition.
92
+
93
+ While this function is easily replicable using the python logging SMTPHandler, the
94
+ TraceErrorsMiddleware is explicitly meant for web applications crash reporting
95
+ which has the benefit of being able to provide more complete information and keep a clear
96
+ and separate process in managing errors.
97
+
98
+ Example
99
+ ++++++++++++++++++++++++++++++++
100
+
101
+ The TraceErrorsMiddleware is used by TurboGears in the following way::
102
+
103
+ from backlash.trace_errors import EmailReporter
104
+
105
+ def _turbogears_backlash_context(environ):
106
+ tgl = environ.get('tg.locals')
107
+ return {'request':getattr(tgl, 'request', None)}
108
+
109
+ app = backlash.TraceErrorsMiddleware(app, [EmailReporter(**errorware)],
110
+ context_injectors=[_turbogears_backlash_context])
111
+
112
+ Slow Requests Tracing
113
+ ---------------------------------------
114
+
115
+ The ``TraceSlowRequestsMiddleware`` provides a WSGI middleware that tracks requests
116
+ execution time and reports requests that took more than a specified interval to complete
117
+ (by default 25 seconds).
118
+
119
+ It is also possible to exclude a list of paths that start with a specified string
120
+ to avoid reporting long polling connections or other kind of requests that are
121
+ expected to have a long life spawn.
122
+
123
+ Example
124
+ ++++++++++++++++++++++++++++++++
125
+
126
+ The TraceSlowRequestsMiddleware is used by TurboGears in the following way::
127
+
128
+ from backlash.trace_errors import EmailReporter
129
+
130
+ def _turbogears_backlash_context(environ):
131
+ tgl = environ.get('tg.locals')
132
+ return {'request':getattr(tgl, 'request', None)}
133
+
134
+ app = backlash.TraceSlowRequestsMiddleware(app, [EmailReporter(**errorware)],
135
+ interval=25, exclude_paths=None,
136
+ context_injectors=[_turbogears_backlash_context])
137
+
138
+
@@ -1,3 +1,4 @@
1
+ AUTHORS
1
2
  LICENSE
2
3
  MANIFEST.in
3
4
  README.rst
@@ -7,7 +7,7 @@ try:
7
7
  except IOError:
8
8
  README = ''
9
9
 
10
- version = "0.3.0"
10
+ version = "0.3.2"
11
11
 
12
12
  setup(name='backlash',
13
13
  version=version,
backlash-0.3.0/PKG-INFO DELETED
@@ -1,134 +0,0 @@
1
- Metadata-Version: 1.1
2
- Name: backlash
3
- Version: 0.3.0
4
- Summary: Standalone WebOb port of the Werkzeug Debugger with Python3 support meant to replace WebError in future TurboGears2
5
- Home-page: https://github.com/TurboGears/backlash
6
- Author: Alessandro Molina
7
- Author-email: amol@turbogears.org
8
- License: MIT
9
- Description: About backlash
10
- -------------------------
11
-
12
- backlash is a swiss army knife for web applications debugging, which provides:
13
-
14
- - An Interactive In Browser Debugger based on a Werkzeug Debugger fork ported to WebOb
15
- - Crash reporting by email and on Sentry
16
- - Slow requests reporting by email and on Sentry.
17
-
18
- Backlash was born as a replacement for WebError in TurboGears2.3 versions.
19
-
20
- Installing
21
- -------------------------------
22
-
23
- backlash can be installed from pypi::
24
-
25
- pip install backlash
26
-
27
- should just work for most of the users
28
-
29
- Debugging and Console
30
- ----------------------------------
31
-
32
- Backlash supports both debugging applications on crash and realtime console,
33
- both are based on the Werkzeug Debugger and adapted to work with WebOb.
34
-
35
- The debugging function is provided by the ``DebuggedApplication`` middleware,
36
- wrapping your application with this middleware will intercept any exception
37
- and display the traceback and an interactive console in your browser.
38
-
39
- An interactive console will also be always available at ``/__console__`` path.
40
-
41
- Context Injectors
42
- +++++++++++++++++++++++++++++
43
-
44
- The ``DebuggedApplication`` middleware also makes possible to provide one or more
45
- ``context injectors``, those are simple python functions that will be called when
46
- an exception is raised to retrieve the context to store and make back available during
47
- debugging.
48
-
49
- Context injectors have to return a dictionary which will be merged into the current
50
- request context, the request context itself will be made available inside the debugger
51
- as the ``ctx`` object.
52
-
53
- This feature is used for example by TurboGears to provide back some of the objects
54
- which were available during execution like the current request.
55
-
56
- Example
57
- +++++++++++++++++++++++++++++++
58
-
59
- The DebuggedApplication middleware is used by TurboGears in the following way::
60
-
61
- def _turbogears_backlash_context(environ):
62
- tgl = environ.get('tg.locals')
63
- return {'request':getattr(tgl, 'request', None)}
64
-
65
- app = backlash.DebuggedApplication(app, context_injectors=[_turbogears_backlash_context])
66
-
67
-
68
- Exception Tracing
69
- ---------------------------------------
70
-
71
- The ``TraceErrorsMiddleware`` provides a WSGI middleware that intercepts any exception
72
- raised during execution, retrieves a traceback object and provides it to one or more
73
- ``reporters`` to log the error.
74
-
75
- By default the ``EmailReporter`` and ``SentryReporter`` are provided to send error
76
- reports by email and on Sentry.
77
-
78
- The ``EmailReporter`` supports most of the options WebError ErrorMiddleware to provide some
79
- kind of backward compatibility and make possible a quick transition.
80
-
81
- While this function is easily replicable using the python logging SMTPHandler, the
82
- TraceErrorsMiddleware is explicitly meant for web applications crash reporting
83
- which has the benefit of being able to provide more complete information and keep a clear
84
- and separate process in managing errors.
85
-
86
- Example
87
- ++++++++++++++++++++++++++++++++
88
-
89
- The TraceErrorsMiddleware is used by TurboGears in the following way::
90
-
91
- from backlash.trace_errors import EmailReporter
92
-
93
- def _turbogears_backlash_context(environ):
94
- tgl = environ.get('tg.locals')
95
- return {'request':getattr(tgl, 'request', None)}
96
-
97
- app = backlash.TraceErrorsMiddleware(app, [EmailReporter(**errorware)],
98
- context_injectors=[_turbogears_backlash_context])
99
-
100
- Slow Requests Tracing
101
- ---------------------------------------
102
-
103
- The ``TraceSlowRequestsMiddleware`` provides a WSGI middleware that tracks requests
104
- execution time and reports requests that took more than a specified interval to complete
105
- (by default 25 seconds).
106
-
107
- It is also possible to exclude a list of paths that start with a specified string
108
- to avoid reporting long polling connections or other kind of requests that are
109
- expected to have a long life spawn.
110
-
111
- Example
112
- ++++++++++++++++++++++++++++++++
113
-
114
- The TraceSlowRequestsMiddleware is used by TurboGears in the following way::
115
-
116
- from backlash.trace_errors import EmailReporter
117
-
118
- def _turbogears_backlash_context(environ):
119
- tgl = environ.get('tg.locals')
120
- return {'request':getattr(tgl, 'request', None)}
121
-
122
- app = backlash.TraceSlowRequestsMiddleware(app, [EmailReporter(**errorware)],
123
- interval=25, exclude_paths=None,
124
- context_injectors=[_turbogears_backlash_context])
125
-
126
- Keywords: wsgi
127
- Platform: UNKNOWN
128
- Classifier: Intended Audience :: Developers
129
- Classifier: License :: OSI Approved :: MIT License
130
- Classifier: Programming Language :: Python
131
- Classifier: Programming Language :: Python :: 2.7
132
- Classifier: Programming Language :: Python :: 3
133
- Classifier: Topic :: Internet :: WWW/HTTP :: WSGI :: Middleware
134
- Classifier: Topic :: Internet :: WWW/HTTP :: WSGI
@@ -1,134 +0,0 @@
1
- Metadata-Version: 1.1
2
- Name: backlash
3
- Version: 0.3.0
4
- Summary: Standalone WebOb port of the Werkzeug Debugger with Python3 support meant to replace WebError in future TurboGears2
5
- Home-page: https://github.com/TurboGears/backlash
6
- Author: Alessandro Molina
7
- Author-email: amol@turbogears.org
8
- License: MIT
9
- Description: About backlash
10
- -------------------------
11
-
12
- backlash is a swiss army knife for web applications debugging, which provides:
13
-
14
- - An Interactive In Browser Debugger based on a Werkzeug Debugger fork ported to WebOb
15
- - Crash reporting by email and on Sentry
16
- - Slow requests reporting by email and on Sentry.
17
-
18
- Backlash was born as a replacement for WebError in TurboGears2.3 versions.
19
-
20
- Installing
21
- -------------------------------
22
-
23
- backlash can be installed from pypi::
24
-
25
- pip install backlash
26
-
27
- should just work for most of the users
28
-
29
- Debugging and Console
30
- ----------------------------------
31
-
32
- Backlash supports both debugging applications on crash and realtime console,
33
- both are based on the Werkzeug Debugger and adapted to work with WebOb.
34
-
35
- The debugging function is provided by the ``DebuggedApplication`` middleware,
36
- wrapping your application with this middleware will intercept any exception
37
- and display the traceback and an interactive console in your browser.
38
-
39
- An interactive console will also be always available at ``/__console__`` path.
40
-
41
- Context Injectors
42
- +++++++++++++++++++++++++++++
43
-
44
- The ``DebuggedApplication`` middleware also makes possible to provide one or more
45
- ``context injectors``, those are simple python functions that will be called when
46
- an exception is raised to retrieve the context to store and make back available during
47
- debugging.
48
-
49
- Context injectors have to return a dictionary which will be merged into the current
50
- request context, the request context itself will be made available inside the debugger
51
- as the ``ctx`` object.
52
-
53
- This feature is used for example by TurboGears to provide back some of the objects
54
- which were available during execution like the current request.
55
-
56
- Example
57
- +++++++++++++++++++++++++++++++
58
-
59
- The DebuggedApplication middleware is used by TurboGears in the following way::
60
-
61
- def _turbogears_backlash_context(environ):
62
- tgl = environ.get('tg.locals')
63
- return {'request':getattr(tgl, 'request', None)}
64
-
65
- app = backlash.DebuggedApplication(app, context_injectors=[_turbogears_backlash_context])
66
-
67
-
68
- Exception Tracing
69
- ---------------------------------------
70
-
71
- The ``TraceErrorsMiddleware`` provides a WSGI middleware that intercepts any exception
72
- raised during execution, retrieves a traceback object and provides it to one or more
73
- ``reporters`` to log the error.
74
-
75
- By default the ``EmailReporter`` and ``SentryReporter`` are provided to send error
76
- reports by email and on Sentry.
77
-
78
- The ``EmailReporter`` supports most of the options WebError ErrorMiddleware to provide some
79
- kind of backward compatibility and make possible a quick transition.
80
-
81
- While this function is easily replicable using the python logging SMTPHandler, the
82
- TraceErrorsMiddleware is explicitly meant for web applications crash reporting
83
- which has the benefit of being able to provide more complete information and keep a clear
84
- and separate process in managing errors.
85
-
86
- Example
87
- ++++++++++++++++++++++++++++++++
88
-
89
- The TraceErrorsMiddleware is used by TurboGears in the following way::
90
-
91
- from backlash.trace_errors import EmailReporter
92
-
93
- def _turbogears_backlash_context(environ):
94
- tgl = environ.get('tg.locals')
95
- return {'request':getattr(tgl, 'request', None)}
96
-
97
- app = backlash.TraceErrorsMiddleware(app, [EmailReporter(**errorware)],
98
- context_injectors=[_turbogears_backlash_context])
99
-
100
- Slow Requests Tracing
101
- ---------------------------------------
102
-
103
- The ``TraceSlowRequestsMiddleware`` provides a WSGI middleware that tracks requests
104
- execution time and reports requests that took more than a specified interval to complete
105
- (by default 25 seconds).
106
-
107
- It is also possible to exclude a list of paths that start with a specified string
108
- to avoid reporting long polling connections or other kind of requests that are
109
- expected to have a long life spawn.
110
-
111
- Example
112
- ++++++++++++++++++++++++++++++++
113
-
114
- The TraceSlowRequestsMiddleware is used by TurboGears in the following way::
115
-
116
- from backlash.trace_errors import EmailReporter
117
-
118
- def _turbogears_backlash_context(environ):
119
- tgl = environ.get('tg.locals')
120
- return {'request':getattr(tgl, 'request', None)}
121
-
122
- app = backlash.TraceSlowRequestsMiddleware(app, [EmailReporter(**errorware)],
123
- interval=25, exclude_paths=None,
124
- context_injectors=[_turbogears_backlash_context])
125
-
126
- Keywords: wsgi
127
- Platform: UNKNOWN
128
- Classifier: Intended Audience :: Developers
129
- Classifier: License :: OSI Approved :: MIT License
130
- Classifier: Programming Language :: Python
131
- Classifier: Programming Language :: Python :: 2.7
132
- Classifier: Programming Language :: Python :: 3
133
- Classifier: Topic :: Internet :: WWW/HTTP :: WSGI :: Middleware
134
- Classifier: Topic :: Internet :: WWW/HTTP :: WSGI
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes