Edgewall Software
Modify

Opened 17 years ago

Closed 17 years ago

Last modified 17 years ago

#5432 closed defect (fixed)

Timeline raises exception in 0.11dev (r5608)

Reported by: anonymous Owned by: Christian Boos
Priority: normal Milestone: 0.11
Component: roadmap Version: devel
Severity: minor Keywords:
Cc: djc@… Branch:
Release Notes:
API Changes:
Internal Changes:

Description

Recently I have been experiencing errors trying to use my Timeline.

For some reason the interactive traceback is not appearing in the error template. So here is the traceback from trac.log:

2007-06-06 12:40:55,975 Trac[web_ui] ERROR: Timeline event provider MilestoneModule failed
Traceback (most recent call last):
  File "/usr/lib/python2.3/site-packages/Trac-0.11dev_r5605-py2.3.egg/trac/timeline/web_ui.py", line 148, in process_request
    filters):
  File "/usr/lib/python2.3/site-packages/Trac-0.11dev_r5605-py2.3.egg/trac/ticket/roadmap.py", line 405, in get_timeline_events
    for event in AttachmentModule(self.env) \
  File "/usr/lib/python2.3/site-packages/Trac-0.11dev_r5605-py2.3.egg/trac/attachment.py", line 460, in get_timeline_events
    for change, realm, id, filename, time, descr, author in \
  File "/usr/lib/python2.3/site-packages/Trac-0.11dev_r5605-py2.3.egg/trac/attachment.py", line 449, in get_history
    "        AND type = %s", (start, stop, realm))
  File "/usr/lib/python2.3/site-packages/Trac-0.11dev_r5605-py2.3.egg/trac/db/util.py", line 50, in execute
    return self.cursor.execute(sql_escape_percent(sql), args)
  File "/usr/lib/python2.3/site-packages/sqlite/main.py", line 255, in execute
    self.rs = self.con.db.execute(SQL % parms)
DatabaseError: near "(": syntax error

After investigation I discovered that the wrong types of timestamp were being passed into the attachment module from the roadmap module. I applied the following change and the problem went away:

Index: trac/ticket/roadmap.py
===================================================================
--- trac/ticket/roadmap.py      (revision 5608)
+++ trac/ticket/roadmap.py      (working copy)
@@ -386,12 +386,13 @@
 
     def get_timeline_events(self, req, start, stop, filters):
         if 'milestone' in filters:
+            start, stop = to_timestamp(start), to_timestamp(stop)
             context = Context(self.env, req)
             cursor = context.db.cursor()
             # TODO: creation and (later) modifications should also be reported
             cursor.execute("SELECT completed,name,description FROM milestone "
                            "WHERE completed>=%s AND completed<=%s",
-                           (to_timestamp(start), to_timestamp(stop)))
+                           (start, stop))
             for ts, name, description in cursor:
                 completed = datetime.fromtimestamp(ts, utc)
                 title = tag('Milestone ', tag.em(name), ' completed')

Attachments (1)

attachment_datetime-r5609.diff (3.5 KB ) - added by Christian Boos 17 years ago.
Alternative fix, with the attachment API making use of datetime objects

Download all attachments as: .zip

Change History (8)

comment:1 by djc@…, 17 years ago

Cc: djc@… added

Forgot to enter my email address.

comment:2 by Christian Boos, 17 years ago

Owner: changed from Christopher Lenz to Christian Boos
Severity: normalminor
Status: newassigned

Yes, you're right.

by Christian Boos, 17 years ago

Alternative fix, with the attachment API making use of datetime objects

comment:3 by Christian Boos, 17 years ago

Can you please try out the alternative fix, attachment_datetime-r5609.diff?

in reply to:  3 comment:4 by djc@…, 17 years ago

Replying to cboos:

Can you please try out the alternative fix, attachment_datetime-r5609.diff?

That one also does the trick, and is clearly superior.

comment:5 by Christian Boos, 17 years ago

Resolution: fixed
Status: assignedclosed

Patch applied in r5613, thanks for testing it!

comment:6 by djc@…, 17 years ago

Thanks for acting on the patch so quickly.

By way of contrast, I have submitted a similarly teeny patch to http://sourceforge.net/projects/pypgsql/ almost eight months ago and there is no evidence that they have even looked at it.

So here is a new FAQ:

Why should I use Trac?

Because the Trac developers are close to 1000 times more responsive than the pyPgSQL developers.

comment:7 by Christian Boos, 17 years ago

He, thanks, but to be honest, there's a lot of dusty tickets here as well, including some with good patches. In the present case, a quick fix was in order because this fixed a problem that I introduced a few days ago…

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.