Opened 9 years ago

Closed 8 years ago

#2674 closed defect (fixed)

IndexError: list index out of range

Reported by: nulleke76@… Owned by: eblot
Priority: normal Component: RevtreePlugin
Severity: major Keywords:
Cc: nulleke76@… Trac Release: 0.11


Using the revtree plugin on the latest trac svn, it gives the following error (when logged on on the base url, without /wiki):

Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/Trac-0.11dev_r6631-py2.5.egg/trac/web/", line 232, in dispatch
  File "/usr/lib/python2.5/site-packages/Trac-0.11dev_r6631-py2.5.egg/trac/web/", line 297, in _post_process_request
    resp = f.post_process_request(req, *(None,)*arity)
  File "build/bdist.linux-i686/egg/revtree/", line 158, in post_process_request
    if (url_parts > 1) and (url_parts[1] in self.contexts):
IndexError: list index out of range

this is caused in:

    url_parts = req.path_info.split(u'/')
    if (url_parts > 1) and (url_parts[1] in self.contexts):

Attachments (0)

Change History (4)

comment:1 Changed 9 years ago by anonymous

I see the same problem. Only when accessing root URI.

comment:2 Changed 8 years ago by anonymous

I have the same problem. "/trac" gives "list index out of range" but "/trac/wiki" it's ok.

My configuration is: Trac: 0.11 Python: 2.4.4 (#1, Jan 10 2007, 01:25:01) [C] setuptools: 0.6c8 SQLite: 3.5.9 pysqlite: 2.4.1 Genshi: 0.5 mod_python: 3.3.1 Subversion: 1.5.0 (r31699) jQuery: 1.2.3

comment:3 Changed 8 years ago by anonymous

I have solved the problem in my Trac installation:

In the line 158:

  • if (url_parts > 1) and (url_parts[1] in self.contexts): IndexError: list index out of range

"url_parts > 1" is wrong, must be "len(url_parts)"

  • with the next lines works fine:

def post_process_request(self, req, template, data, content_type):

if req.perm.has_permission('REVTREE_VIEW'):

url_parts = req.path_info.split(u'/') if (len(url_parts) > 1):

if (url_parts[1] in self.contexts):

add_ctxtnav(req, 'Revtree', href=req.href.revtree())

return (template, data, content_type)

comment:4 Changed 8 years ago by eblot

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

(In [4012]) Closes #2674.

  • Fix up the invalid syntax in url_parts
  • Use the new Trac API for options (so that TracIni now shows up the proper option)

Thanks to anonymous for the original patch.

Add Comment

Modify Ticket

as closed The owner will remain eblot.
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.