Modify

Opened 9 years ago

Closed 2 years ago

#4930 closed defect (fixed)

[Patch] "TypeError: can't compare datetime.datetime to float" if search term appears in both wiki and attachments

Reported by: srl100@… Owned by: deltroo
Priority: normal Component: SearchAttachmentsPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.11

Description

If you have a search term that appears in both the wiki and an attachment, Trac throws an error "TypeError: can't compare datetime.datetime to float".

My guess, from the error text, is that it is trying to sort the search results into date order, but is getting different date types from the different areas.

How to Reproduce

While doing a GET operation on /search, Trac issued an internal error.

(please provide additional details here)

Request parameters:

{'attachments': u'on',
 'milestone': u'on',
 'noquickjump': u'1',
 'q': u'repositories',
 'ticket': u'on',
 'wiki': u'on'}

User Agent was: Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.9.0.8) Gecko/2009032711 Ubuntu/8.10 (intrepid) Firefox/3.0.8

System Information

Trac 0.11.4
Python 2.5.2 (r252:60911, Oct 5 2008, 19:24:49)
[GCC 4.3.2]
setuptools 0.6c9
SQLite 3.5.9
pysqlite 2.3.2
Genshi 0.5.1
jQuery: 1.2.6

Python Traceback

Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/Trac-0.11.4-py2.5.egg/trac/web/main.py", line 435, in _dispatch_request
    dispatcher.dispatch(req)
  File "/usr/lib/python2.5/site-packages/Trac-0.11.4-py2.5.egg/trac/web/main.py", line 205, in dispatch
    resp = chosen_handler.process_request(req)
  File "/usr/lib/python2.5/site-packages/Trac-0.11.4-py2.5.egg/trac/search/web_ui.py", line 107, in process_request
    results.sort(lambda x,y: cmp(y[2], x[2]))
  File "/usr/lib/python2.5/site-packages/Trac-0.11.4-py2.5.egg/trac/search/web_ui.py", line 107, in <lambda>
    results.sort(lambda x,y: cmp(y[2], x[2]))
TypeError: can't compare datetime.datetime to float

Attachments (1)

4930_1.patch (315 bytes) - added by srl100@… 9 years ago.

Download all attachments as: .zip

Change History (3)

Changed 9 years ago by srl100@…

Attachment: 4930_1.patch added

comment:2 Changed 8 years ago by Ryan J Ollos

Summary: Trac reports "TypeError: can't compare datetime.datetime to float" if search term appears in both wiki and attachments[Patch] "TypeError: can't compare datetime.datetime to float" if search term appears in both wiki and attachments

comment:3 Changed 2 years ago by Ryan J Ollos

Resolution: fixed
Status: newclosed

In 14892:

Convert to datetime. Untested patch by srl100@…. Fixes #4930.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain deltroo.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.