#13687 closed defect (fixed)
TypeError: %b requires a bytes-like object, or an object that implements __bytes__, not 'int'
| Reported by: | Dirk Stöcker | Owned by: | Jun Omae |
|---|---|---|---|
| Priority: | normal | Milestone: | 1.6.1 |
| Component: | report system | Version: | 1.6 |
| Severity: | normal | Keywords: | |
| Cc: | Branch: | ||
| Release Notes: |
Fixed a |
||
| API Changes: | |||
| Internal Changes: | |||
Description
Report 9 of josm.openstreetmap.de fails when called with format=sql as argument:
Internal Server Error: <RequestWithSession "GET '/report/9?format=sql'">, referrer None
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/trac/web/main.py", line 609, in dispatch_request
dispatcher.dispatch(req)
File "/usr/local/lib/python3.10/dist-packages/trac/web/main.py", line 301, in dispatch
raise e
File "/usr/local/lib/python3.10/dist-packages/trac/web/main.py", line 247, in dispatch
resp = chosen_handler.process_request(req)
File "/usr/local/lib/python3.10/dist-packages/trac/ticket/report.py", line 188, in process_request
template, data, content_type = self._render_view(req, id)
File "/usr/local/lib/python3.10/dist-packages/trac/ticket/report.py", line 382, in _render_view
self._send_sql(req, id, title, description, sql)
File "/usr/local/lib/python3.10/dist-packages/trac/ticket/report.py", line 941, in _send_sql
out.write(b'-- ## %s: %s ## --\n\n' % (id, title.encode('utf-8')))
TypeError: %b requires a bytes-like object, or an object that implements __bytes__, not 'int'
report is
SELECT id AS ticket, summary, component, type, owner, status FROM ticket t WHERE status <> 'closed' AND (owner=$USER OR reporter=$USER) ORDER BY id desc
Fix:
-
report.py
old new 938 938 req.perm(self.realm, id).require('REPORT_SQL_VIEW') 939 939 940 940 out = io.BytesIO() 941 out.write(b'-- ## %s: %s ## --\n\n' % ( id, title.encode('utf-8')))941 out.write(b'-- ## %s: %s ## --\n\n' % (str(id).encode("utf-8"), title.encode('utf-8'))) 942 942 if description: 943 943 lines = description.encode('utf-8').splitlines() 944 out.write(b'-- %s\n\n' % '\n-- '.join(lines))944 out.write(b'-- %s\n\n' % b'\n-- '.join(lines)) 945 945 out.write(sql.encode('utf-8')) 946 946 data = out.getvalue() 947 947
Attachments (0)
Change History (4)
comment:1 by , 22 months ago
| Milestone: | → 1.6.1 |
|---|---|
| Version: | → 1.6 |
comment:2 by , 18 months ago
| Release Notes: | modified (diff) |
|---|---|
| Resolution: | → fixed |
| Status: | new → closed |
follow-up: 4 comment:3 by , 18 months ago
Let me know if we need to do a software release. I have a week off at the beginning of July. I plan to work on Edgewall infrastructure and pushing out new releases. If we need one before July I can help make that happen.
comment:4 by , 18 months ago
| Owner: | set to |
|---|
Replying to Ryan J Ollos:
Let me know if we need to do a software release. I have a week off at the beginning of July. I plan to work on Edgewall infrastructure and pushing out new releases. If we need one before July I can help make that happen.
I consider Trac 1.6 has no critical bugs and not needed a new release before beginning of July. I will be fixing tickets in milestone:1.6.1 for a new release on July. Thanks.



Thanks for the reporting!