Edgewall Software
Modify

Opened 7 years ago

Closed 7 years ago

#12958 closed defect (fixed)

Query page raises a TypeError if custom field named "id" exists

Reported by: Jun Omae Owned by: Jun Omae
Priority: normal Milestone: 1.0.17
Component: ticket system Version: 1.0.15
Severity: normal Keywords:
Cc: Branch:
Release Notes:

Fix query crashing when id as a custom field is defined.

API Changes:
Internal Changes:

Description

How to reproduce

  1. Create new environment — initenv
  2. Add a custom field named "id" — config set ticket-custom id text
  3. Create new ticket
  4. 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):  
    364364
    365365    reserved_field_names = ['report', 'order', 'desc', 'group', 'groupdesc',
    366366                            'col', 'row', 'format', 'max', 'page', 'verbose',
    367                             'comment', 'or']
     367                            'comment', 'or', 'id']
    368368
    369369    def get_custom_fields(self):
    370370        return copy.deepcopy(self.custom_fields)

I'll post unit tests later.

Attachments (0)

Change History (3)

comment:1 by Jun Omae, 7 years ago

Owner: set to Jun Omae
Status: newassigned

Proposed changes in [b4c1e5862/jomae.git].

comment:2 by Ryan J Ollos, 7 years ago

Looks good to me.

comment:3 by Jun Omae, 7 years ago

Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Thanks. Committed in [16403] and merged in [16404,16405].

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jun Omae.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Jun Omae to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.