0001-settings-remove-option-to-set-exception-display-styl.patch
tests/test_publisher.py | ||
---|---|---|
87 | 87 |
assert body == '{"err": 1}' |
88 | 88 | |
89 | 89 |
req = get_request() |
90 |
pub.config.display_exceptions = 'text' |
|
90 |
pub.cfg['debug'] = {'debug_mode': True} |
|
91 |
pub.write_cfg() |
|
92 |
pub.set_config(request=req) |
|
91 | 93 |
pub._set_request(req) |
92 | 94 |
try: |
93 | 95 |
raise Exception() |
... | ... | |
96 | 98 |
assert 'Traceback (most recent call last)' in str(body) |
97 | 99 |
assert '<div class="error-page">' not in str(body) |
98 | 100 | |
99 |
req = get_request() |
|
100 |
pub.config.display_exceptions = 'text-in-html' |
|
101 |
pub._set_request(req) |
|
102 |
try: |
|
103 |
raise Exception() |
|
104 |
except Exception: |
|
105 |
body = pub.finish_failed_request() |
|
106 |
assert 'Traceback (most recent call last)' in str(body) |
|
107 |
assert '<div class="error-page">' in str(body) |
|
108 | ||
109 | 101 | |
110 | 102 |
def test_finish_interrupted_request(): |
111 | 103 |
req = HTTPRequest( |
wcs/qommon/admin/settings.py | ||
---|---|---|
73 | 73 |
title=_('Email for Tracebacks'), |
74 | 74 |
value=debug_cfg.get('error_email', ''), |
75 | 75 |
) |
76 |
form.add( |
|
77 |
SingleSelectWidget, |
|
78 |
'display_exceptions', |
|
79 |
title=_('Display Exceptions'), |
|
80 |
value=debug_cfg.get('display_exceptions', ''), |
|
81 |
options=[ |
|
82 |
('', _('No display')), |
|
83 |
('text', _('Display as Text')), |
|
84 |
('text-in-html', _('Display as Text in an HTML error page')), |
|
85 |
('html', _('Display as HTML')), |
|
86 |
], |
|
87 |
) |
|
88 | 76 |
form.add(CheckboxWidget, 'logger', title=_('Logger'), value=debug_cfg.get('logger', True)) |
89 | 77 |
form.add( |
90 | 78 |
CheckboxWidget, |
... | ... | |
116 | 104 |
cfg_submit( |
117 | 105 |
form, |
118 | 106 |
'debug', |
119 |
('error_email', 'display_exceptions', 'logger', 'debug_mode', 'mail_redirection'),
|
|
107 |
('error_email', 'logger', 'debug_mode', 'mail_redirection'), |
|
120 | 108 |
) |
121 | 109 |
return redirect('.') |
wcs/qommon/publisher.py | ||
---|---|---|
313 | 313 |
# DISPLAY_EXCEPTIONS is false, so return the most |
314 | 314 |
# secure (and cryptic) page. |
315 | 315 |
error_page = self._generate_internal_error(request) |
316 |
elif self.config.display_exceptions == 'html': |
|
317 |
# Generate a spiffy HTML display using cgitb |
|
318 |
error_page = self._generate_cgitb_error(request, original_response, exc_type, exc_value, tb) |
|
319 |
elif self.config.display_exceptions == 'text-in-html': |
|
320 |
error_page = template.error_page( |
|
321 |
_('The server encountered an internal error and was unable to complete your request.'), |
|
322 |
error_title=_('Internal Server Error'), |
|
323 |
exception=plain_error_msg, |
|
324 |
) |
|
325 | 316 |
else: |
326 | 317 |
# Generate a plaintext page containing the traceback |
327 | 318 |
request.response.set_header('Content-Type', 'text/plain') |
... | ... | |
438 | 429 |
debug_cfg = self.cfg.get('debug', {}) |
439 | 430 |
self.logger.error_email = debug_cfg.get('error_email') |
440 | 431 |
self.logger.error_email_from = self.cfg.get('emails', {}).get('from') |
441 |
self.config.display_exceptions = debug_cfg.get('display_exceptions')
|
|
432 |
self.config.display_exceptions = debug_cfg.get('debug_mode')
|
|
442 | 433 |
self.config.form_tokens = True |
443 | 434 |
self.config.session_cookie_httponly = True |
444 | 435 |
self.config.allowed_methods = ['GET', 'HEAD', 'POST', 'PUT'] |
445 |
- |