Edgewall Software
Modify

Opened 17 years ago

Closed 17 years ago

#7021 closed defect (fixed)

[PATCH] TypeError: int() argument must be a string or a number, not 'NoneType'

Reported by: mhamilt@… Owned by: Christian Boos
Priority: normal Milestone: 0.11
Component: report system Version:
Severity: normal Keywords: query
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description (last modified by Emmanuel Blot)

I've been trying to figure out why sourceforge2trac isn't working for me, so I used sqlite3 to manually create some tickets in a test Trac database. Not knowing SQL very well, I got some wrong, like this one:

485
summary|description|

Then, on the 'Query Tickets' page I removed the 'Owner' and 'Status' filters, and added a "'Summary' contains 'summary'" filter. The traceback shown below was reported.

Now, I realize that the cause of this is the fact that my manually created database entry is incomplete, but it seems to me that the query code shouldn't just barf in that case. A reasonable solution in this case would seem to be to default the date to '0'. I've attached a patch for 0.10 and trunk that does that.

Traceback (most recent call last):
  File "/data0/sierra/trac/trac-0.10stable/lib/python2.5/site-packages/trac/web/main.py", line 406, in dispatch_request
    dispatcher.dispatch(req)
  File "/data0/sierra/trac/trac-0.10stable/lib/python2.5/site-packages/trac/web/main.py", line 237, in dispatch
    resp = chosen_handler.process_request(req)
  File "build/bdist.linux-x86_64/egg/batchmod/web_ui.py", line 52, in process_request
    QueryModule(self.env).process_request(req)
  File "/data0/sierra/trac/trac-0.10stable/lib/python2.5/site-packages/trac/ticket/query.py", line 443, in process_request
    self.display_html(req, query)
  File "/data0/sierra/trac/trac-0.10stable/lib/python2.5/site-packages/trac/ticket/query.py", line 552, in display_html
    tickets = query.execute(req, db)
  File "/data0/sierra/trac/trac-0.10stable/lib/python2.5/site-packages/trac/ticket/query.py", line 171, in execute
    val = int(val)
TypeError: int() argument must be a string or a number, not 'NoneType'

Attachments (1)

query.py.diff (1.1 KB ) - added by mhamilt@… 17 years ago.
Patches to query.py

Download all attachments as: .zip

Change History (5)

by mhamilt@…, 17 years ago

Attachment: query.py.diff added

Patches to query.py

comment:1 by anonymous, 17 years ago

Hmm, it looks like the Wiki formatting messed up my example. The tickets I manually entered looked like this:

sqlite> select ALL * from ticket where summary = 'summary';
485||||||||||||||summary|description|
486|||||||sierra|sierra||||||summary|description|
487|defect||||||sierra|sierra||||||summary|description|
488|task||||||sierra|sierra||||||summary|description|

The problem with them is that the times in the record are empty (not zero.) This results in 'val=None', which causes int(val) to fail.

comment:2 by Emmanuel Blot, 17 years ago

Description: modified (diff)

To be consistent with other ticket resolution, Trac code does not need to be resilient to undermining error such as direct access to the database.

If the error only occurs in the case of direct handling of the underlying DB, I think wontfix applies here.

comment:3 by Christian Boos, 17 years ago

Component: generalreport system
Keywords: query added
Milestone: 0.11.1
Owner: changed from Jonas Borgström to Christian Boos

Well, here it's simply a time or changetime None value given to the query API. Look at the surrounding lines (trunk/trac/ticket/query.py@6785#L212), we actually do some sanity checks and provide sane default for all the other cases.

comment:4 by Christian Boos, 17 years ago

Milestone: 0.11.10.11
Resolution: fixed
Status: newclosed

Fixed in r6830.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christian Boos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christian Boos 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.