Opened 2 years ago

Closed 18 months ago

#11902 closed defect (fixed)

Got an error on the Timeline Page

Reported by: sdegrande Owned by: hasienda
Priority: high Component: DiscussionPlugin
Severity: critical Keywords:
Cc: rjollos, hasienda Trac Release: 1.0


When displaying the Timeline with DiscussionPlugin enabled, I got the following Trac error :

Event provider DiscussionTimeline failed for filters "Forums changes": TypeError: tuple indices must be integers, not str

I use Trac 1.1.1 + Python 2.7.3 + TracDiscussion 0.9dev-r13945

Please find attached a patch that fixes it for me.

Attachments (2)

fix_error_on_timeline.diff (707 bytes) - added by sdegrande 2 years ago.
discussionplugin-t11902-r14133.diff (3.0 KB) - added by jun66j5 2 years ago.

Download all attachments as: .zip

Change History (11)

Changed 2 years ago by sdegrande

comment:1 Changed 2 years ago by rjollos

  • Cc hasienda added

comment:2 Changed 2 years ago by hasienda

Would you explain the proposed change a bit more, please?

AFAIKS the patch is badly formatted and patched Python code will not run due to indentation issues. So I doubt that you tested with the patched code. Furthermore the patch just decomposes the list comprehension, what should have zero effect on the reported issue with tuple indices. But maybe I'm overlooking something here?

comment:3 Changed 2 years ago by jun66j5

#11957 was closed as duplicate.

Changed 2 years ago by jun66j5

comment:4 Changed 2 years ago by jun66j5

We should add unit tests for that, see discussionplugin-t11902-r14133.diff.

The row variable is a tuple in discussionplugin/0.11/tracdiscussion/

        return [dict(zip(columns, row),
                for row in cursor]

comment:5 Changed 2 years ago by sdegrande

Sorry, I did not see that you commented this ticket 2 weeks ago, hasienda.

Sorry for the bad formatted patch (I use it and it runs, so something went wrong when I uploaded the diff).

As far as I understand it, the error comes from the execution of row['status'], because row is not 'yet' a dict when used in the call to topic_status_to_list() (I can be wrong, I'm not a python expert at all).

That's why, in my patch, I first retrieve the dict(zip(...)) before to call topic_status_to_list(row['status'])

jun66j5's patch is indeed much better, in my humble opinion.

Last edited 2 years ago by hasienda (previous) (diff)

comment:6 Changed 2 years ago by hasienda

Thank you Jun for helping with the explanation and handling the other ticket. I'll apply your smaller fix, happily extending the unit test harness.

comment:7 Changed 2 years ago by hasienda

In 14139:

DiscussionPlugin: Prevent TypeError: tuple indices must be integers, not str, refs #11902.

Thanks to Samuel Degrande for the original report and to Jun Omae for
explaining the issue and providing both, an elegant fix and improved unit tests.

comment:8 Changed 2 years ago by hasienda

  • Owner changed from anonymous to hasienda
  • Status changed from new to assigned

comment:9 Changed 18 months ago by rjollos

  • Resolution set to fixed
  • Status changed from assigned to closed

Add Comment

Modify Ticket

as closed The owner will remain hasienda.
The resolution will be deleted. Next status will be 'reopened'.

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

Note: See TracTickets for help on using tickets.