[Zope] M. Renfro's sitemap -error

Mike Renfro renfro@tntech.edu
Mon, 6 May 2002 09:20:24 -0500


On Mon, May 06, 2002 at 12:09:51PM +0200, Marie ROBICHON wrote:

> I get an error when I try to test the menu_list script:
> 
> Error Type: ValueError
> Error Value: list.index(x): x not in list
> 
> on line 18:
> top_parent_index=folder_list.index(parent_folders[-1])
> 
> Since I am a real newbie to Python it may be something obvious here, any 
> clues anyone?

The error message is literal enough: whatever object the last entry in
parent_folders refers to isn't showing up in
folder_list. parent_folders should be a list of all the parents of an
object, and the last element should be a top-level folder. Maybe the
list got reversed an extra time, or never reversed at all?

I'd focus my examination on the list_top_folders and
list_parent_folders scripts.

PS: in looking at list_parent_folders here, I'm going to have to look
back and determine if I really meant to have the ids2.reverse() line
indented inside the for loop or not. It's probably supposed to be at
the same level of indentation as the for loop, so that it would only
get run once.

One may not be able to write illegible Python code, but undocumented
Python code comes pretty close.

-- 
Mike Renfro  / R&D Engineer, Center for Manufacturing Research,
931 372-3601 / Tennessee Technological University -- renfro@tntech.edu