Opened 6 years ago
Last modified 6 years ago
#12958 closed defect
Query page raises a TypeError if custom field named "id" exists — at Initial Version
Reported by: | Jun Omae | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | 1.0.17 |
Component: | ticket system | Version: | 1.0.15 |
Severity: | normal | Keywords: | |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
How to reproduce
- Create new environment —
initenv
- Add a custom field named "id" —
config set ticket-custom id text
- Create new ticket
- Visit
/query?status=!closed
07:39:35 PM Trac[main] ERROR: [192.168.11.25] Internal Server Error: <RequestWithSession "GET '/query?status=!closed'">, referrer None Traceback (most recent call last): File "/venv/trac/1.0.15/lib/python2.5/site-packages/trac/web/main.py", line 567, in _dispatch_request dispatcher.dispatch(req) File "/venv/trac/1.0.15/lib/python2.5/site-packages/trac/web/main.py", line 249, in dispatch resp = chosen_handler.process_request(req) File "/venv/trac/1.0.15/lib/python2.5/site-packages/trac/ticket/query.py", line 1004, in process_request return self.display_html(req, query) File "/venv/trac/1.0.15/lib/python2.5/site-packages/trac/ticket/query.py", line 1102, in display_html tickets = query.execute(req) File "/venv/trac/1.0.15/lib/python2.5/site-packages/trac/ticket/query.py", line 334, in execute val = int(val) TypeError: int() argument must be a string or a number, not 'NoneType'
We should add id
to reserved field names in TicketSystem
:
-
trac/ticket/api.py
diff --git a/trac/ticket/api.py b/trac/ticket/api.py index f032664a2..33396c5c0 100644
a b class TicketSystem(Component): 364 364 365 365 reserved_field_names = ['report', 'order', 'desc', 'group', 'groupdesc', 366 366 'col', 'row', 'format', 'max', 'page', 'verbose', 367 'comment', 'or' ]367 'comment', 'or', 'id'] 368 368 369 369 def get_custom_fields(self): 370 370 return copy.deepcopy(self.custom_fields)
I'll post unit tests later.
Note:
See TracTickets
for help on using tickets.