Edgewall Software
Modify

Opened 17 years ago

Closed 17 years ago

Last modified 14 years ago

#7080 closed defect (duplicate)

TypeError: can't compare datetime.datetime to int

Reported by: dx Owned by: Jonas Borgström
Priority: normal Milestone:
Component: general Version: 0.11b2
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

How to Reproduce

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

Queried for duplicates, removed some with trac-admin, refreshed the page, and got this. It looks like it fails comparing the ticket changes, because if I open that url in a different tab right now, it works fine.

(note: our users literally spammed us with duplicates, since we were getting 500 internal server error on POST. The reason for that is #6986, we have applied that locally and works like a charm)

Request parameters:

{'status': u'closed', 'col': [u'id', u'summary', u'priority'], 'resolution': [u'invalid', u'duplicate'], 'order': u'priority', 'milestone': u'1.1'}

User Agent was: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9b4) Gecko/2008031011 Minefield/3.0b4

System Information

Trac 0.11b2
Python 2.3.5 (#2, Oct 16 2006, 19:19:48)
[GCC 3.3.5 (Debian 1:3.3.5-13)]
setuptools 0.6c7
MySQL server: "5.0.24a-standard-log", client: "5.0.16", thread-safe: 1
MySQLdb 1.2.1_p2
Genshi 0.4.4
jQuery: 1.2.3

Python Traceback

Traceback (most recent call last):
  File "/home/dx/packages/lib/python2.4/site-packages/Trac-0.11b2-py2.4.egg/trac/web/main.py", line 419, in _dispatch_request
    dispatcher.dispatch(req)
  File "/home/dx/packages/lib/python2.4/site-packages/Trac-0.11b2-py2.4.egg/trac/web/main.py", line 196, in dispatch
    resp = chosen_handler.process_request(req)
  File "/home/dx/packages/lib/python2.4/site-packages/Trac-0.11b2-py2.4.egg/trac/ticket/query.py", line 659, in process_request
    return self.display_html(req, query)
  File "/home/dx/packages/lib/python2.4/site-packages/Trac-0.11b2-py2.4.egg/trac/ticket/query.py", line 741, in display_html
    data = query.template_data(context, tickets, orig_list, orig_time)
  File "/home/dx/packages/lib/python2.4/site-packages/Trac-0.11b2-py2.4.egg/trac/ticket/query.py", line 524, in template_data
    if ticket['time'] > orig_time:
TypeError: can't compare datetime.datetime to int

Attachments (0)

Change History (4)

comment:1 by dx@…, 17 years ago

Also, when posting this ticket it complained about bad request, missing or invalid token. The url is the following (note the double )

t.e.o//newticket?__preview=1&reporter=dx&version=0.11b2&summary=TypeError%3A+can't+compare+datetime.datetime+to+int&description=%0D%0A%3D%3D%3D%3D+How+to+Reproduce+%3D%3D%3D%3D%0D%0A%0D%0AWhile+doing+a+GET+operation+on+`%2Fquery`%2C+Trac+issued+an+internal+error.%0D%0A%0D%0A''(please+provide+additional+details+here)''%0D%0A%0D%0A%0D%0ARequest+parameters%3A%0D%0A{{{%0D%0A{'status'%3A+u'closed'%2C+'col'%3A+[u'id'%2C+u'summary'%2C+u'priority']%2C+'resolution'%3A+[u'invalid'%2C+u'duplicate']%2C+'order'%3A+u'priority'%2C+'milestone'%3A+u'1.1'}%0D%0A}}}%0D%0A%0D%0A%0D%0AUser+Agent+was%3A+`Mozilla%2F5.0+(X11%3B+U%3B+Linux+i686%3B+en-US%3B+rv%3A1.9b4)+Gecko%2F2008031011+Minefield%2F3.0b4`%0D%0A%0D%0A%3D%3D%3D%3D+System+Information+%3D%3D%3D%3D%0D%0A%0D%0A||+'''Trac'''+||+`0.11b2`+||%0D%0A||+'''Python'''+||+`2.3.5+(%232%2C+Oct+16+2006%2C+19%3A19%3A48)+`+[[br]]+`[GCC+3.3.5+(Debian+1%3A3.3.5-13)]`+||%0D%0A||+'''setuptools'''+||+`0.6c7`+||%0D%0A||+'''MySQL'''+||+`server%3A+"5.0.24a-standard-log"%2C+client%3A+"5.0.16"%2C+thread-safe%3A+1`+||%0D%0A||+'''MySQLdb'''+||+`1.2.1_p2`+||%0D%0A||+'''Genshi'''+||+`0.4.4`+||%0D%0A||+'''jQuery%3A'''+||+`1.2.3`+||%0D%0A%0D%0A%3D%3D%3D%3D+Python+Traceback+%3D%3D%3D%3D%0D%0A{{{%0D%0ATraceback+(most+recent+call+last)%3A%0D%0A++File+"%2Fhome%2Fdx%2Fpackages%2Flib%2Fpython2.4%2Fsite-packages%2FTrac-0.11b2-py2.4.egg%2Ftrac%2Fweb%2Fmain.py"%2C+line+419%2C+in+_dispatch_request%0D%0A++++dispatcher.dispatch(req)%0D%0A++File+"%2Fhome%2Fdx%2Fpackages%2Flib%2Fpython2.4%2Fsite-packages%2FTrac-0.11b2-py2.4.egg%2Ftrac%2Fweb%2Fmain.py"%2C+line+196%2C+in+dispatch%0D%0A++++resp+%3D+chosen_handler.process_request(req)%0D%0A++File+"%2Fhome%2Fdx%2Fpackages%2Flib%2Fpython2.4%2Fsite-packages%2FTrac-0.11b2-py2.4.egg%2Ftrac%2Fticket%2Fquery.py"%2C+line+659%2C+in+process_request%0D%0A++++return+self.display_html(req%2C+query)%0D%0A++File+"%2Fhome%2Fdx%2Fpackages%2Flib%2Fpython2.4%2Fsite-packages%2FTrac-0.11b2-py2.4.egg%2Ftrac%2Fticket%2Fquery.py"%2C+line+741%2C+in+display_html%0D%0A++++data+%3D+query.template_data(context%2C+tickets%2C+orig_list%2C+orig_time)%0D%0A++File+"%2Fhome%2Fdx%2Fpackages%2Flib%2Fpython2.4%2Fsite-packages%2FTrac-0.11b2-py2.4.egg%2Ftrac%2Fticket%2Fquery.py"%2C+line+524%2C+in+template_data%0D%0A++++if+ticket['time']+>+orig_time%3A%0D%0ATypeError%3A+can't+compare+datetime.datetime+to+int%0D%0A%0D%0A}}}%0D%0A++++&create=Create

I changed it to t.e.o/newticket? and it worked fine. But maybe it's just that it created a session, or something.

comment:2 by Christian Boos, 17 years ago

The primary issue here is a duplicate of #6088, which is fixed in latest trunk.

Now, you could eventually elaborate on those "500 internal server error on POST" which you attribute to the patch on #6986. If you're sure about the relation, please describe that problem in more details directly on #6986, otherwise here.

You're also right about the t.e.o issue, I'll fix that - but I don't think this was the reason of the "Bad Request" error (no idea about that one).

in reply to:  2 comment:3 by dx@…, 17 years ago

Resolution: duplicate
Status: newclosed

#6088

Replying to cboos:

The primary issue here is a duplicate of #6088, which is fixed in latest trunk.

Now, you could eventually elaborate on those "500 internal server error on POST" which you attribute to the patch on #6986. If you're sure about the relation, please describe that problem in more details directly on #6986, otherwise here.

In #6986, here it's offtopic.

I let this ticket rest in peace, then

You're also right about the t.e.o issue, I'll fix that - but I don't think this was the reason of the "Bad Request" error (no idea about that one).

I think that it happens always when posting tickets built by that "create" button in trac tracebacks.

comment:4 by Nadia, 14 years ago

I have the same problem (comparing an int to a datetime.datetime field). How did you manage to solve yours ?

Modify Ticket

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