Modify ↓
Opened 20 months ago
Closed 19 months ago
#13590 closed defect (fixed)
ValueError not logged when a unicode instance is passed to req.send()
Reported by: | Jun Omae | Owned by: | Jun Omae |
---|---|---|---|
Priority: | normal | Milestone: | 1.4.4 |
Component: | rendering | Version: | 1.4.3 |
Severity: | normal | Keywords: | |
Cc: | Branch: | ||
Release Notes: |
Fixed the exception not logged after starting a response. |
||
API Changes: | |||
Internal Changes: |
Description
I noticed that the raised ValueError
is not logged when a unicode
instance is passed to req.send()
and the response is empty. The issue occurs regardless of the [trac] use_chunked_encoding
option.
The behavior appears to have been introduced in [17055] (#13038). The change was based on my suggestion (my fault).
-
trac/web/main.py
diff --git a/trac/web/main.py b/trac/web/main.py index 3645cd990..dc8ec9714 100644
a b def dispatch_request(environ, start_response): 640 640 except RequestDone as req_done: 641 641 resp = req_done.iterable 642 642 except HTTPException as e: 643 if not req.response_started: 644 _send_user_error(req, env, e) 643 _send_user_error(req, env, e) 645 644 except Exception: 646 if not req.response_started: 647 send_internal_error(env, req, sys.exc_info()) 645 send_internal_error(env, req, sys.exc_info()) 648 646 else: 649 647 resp = resp or req._response or [] 650 648 finally: … … def _send_user_error(req, env, e): 706 704 env.log.warning('[%s] %s, %r, referrer %r', 707 705 req.remote_addr, exception_to_unicode(e), 708 706 req, req.environ.get('HTTP_REFERER')) 707 if req.response_started: 708 return 709 709 data = {'title': e.title, 'type': 'TracError', 'message': e.message, 710 710 'frames': [], 'traceback': None} 711 711 if e.code == 403 and not req.is_authenticated: … … def send_internal_error(env, req, exc_info): 721 721 env.log.error("[%s] Internal Server Error: %r, referrer %r%s", 722 722 req.remote_addr, req, req.environ.get('HTTP_REFERER'), 723 723 exception_to_unicode(exc_info[1], traceback=True)) 724 if req.response_started: 725 return 724 726 message = exception_to_unicode(exc_info[1]) 725 727 traceback = get_last_traceback()
(I plan to apply the patch to 1.0-stable and 1.2-stable as well)
Attachments (0)
Change History (1)
comment:1 by , 19 months ago
Release Notes: | modified (diff) |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
Note:
See TracTickets
for help on using tickets.
Fixed in [17695:17698].