Many thanks for your help, worked a treat Jon
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Peter Otten Sent: 16 August 2005 17:25 To: python-list@python.org Subject: RE: looping list problem Jon Bowlas wrote: > Incidentally I'm doing this in zope. Many posters (including me) in this newsgroup don't do zope, so your best option is to ask on a zope-related mailing list. > I was hoping that this would loop through the elements in the list > returned by the hiddens function comparing them with the id of the current > value of c (bert) and if they are the same then it should ignore it and > move onto the next one, but it doesn't seem to do anything. > Ok, so I've adapted my script calling it a hiddens() function and included > it inside my get_tree_html function which creates my navigation: > > pub = context.get_publication() > obj = context.aq_inner > fpath = context.getPhysicalPath() > > def hiddens(): > attobject = context.get_attobject() > navstring = context.get_uclattribute(attobject, 'ucl_navhide') > return navstring.split(' ') > > def get_tree_html(node, endobj): > tree = '' > endpath = endobj.getPhysicalPath() > for c in node.get_ordered_publishables(): > if not c.is_published(): > continue > bert=c.getId(); > if bert=="index_right": > continue > if bert=="images": > continue > # this is where I loop through he elements returned by my hiddens > # function, comparing them with the value of bert Replace these lines > for element in hiddens(): > if element==bert: > continue # with the next hidden element with if bert in hiddens(): continue # with the next publishable c A 'continue' statement only affects the innermost loop, and as you don't have any code that follows it in the for-element-loop it didn't have any effect. Peter -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list