Ticket #2674 (closed defect: fixed)

Opened 6 months ago

Last modified 2 months ago

IndexError: list index out of range

Reported by: nulleke76@gmail.com Assigned to: eblot
Priority: normal Component: RevtreePlugin
Severity: major Keywords:
Cc: nulleke76@gmail.com Trac Release: 0.11

Description

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/main.py", line 232, in dispatch
    self._post_process_request(req)
  File "/usr/lib/python2.5/site-packages/Trac-0.11dev_r6631-py2.5.egg/trac/web/main.py", line 297, in _post_process_request
    resp = f.post_process_request(req, *(None,)*arity)
  File "build/bdist.linux-i686/egg/revtree/web_ui.py", 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

Change History

03/06/08 08:43:38 changed by anonymous

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

07/14/08 02:48:47 changed 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

07/14/08 03:23:22 changed 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)

07/14/08 08:14:57 changed by eblot

  • status changed from new to closed.
  • resolution set to fixed.

(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/Change #2674 (IndexError: list index out of range)




Change Properties
Action