[Zope] restrictedTraverse doesn't give the good container

Paul Winkler pw_lists at slinkp.com
Mon Feb 9 10:53:00 EST 2004


On Mon, Feb 09, 2004 at 03:15:19PM +0100, Pascal Samuzeau wrote:
> I try :                                                               
>                                                                       
> herenow = context.restrictedTraverse(path+'/FolderC')  -> OK          
> herenow = herenow.restrictedTraverse(path+'/FolderC')  -> OK          
>                                                                       
> BUT here I'm just not where I think to be, just because of the        
> acquisition !!!                                                       

Does path start with a slash?

If path is a "absolute-path reference" (i.e. it starts
with a slash), and you do foo.restrictedTraverse(path),
the value of foo does not matter. Therefore,
context.restrictedTraverse(path+'/FolderC') and
herenow.restrictedTraverse(path+'/FolderC') are exactly equivalent.
This is true regardless of how many things you have named '/FolderC'.

-- 

Paul Winkler
http://www.slinkp.com
Look! Up in the sky! It's RETRO-<I>N</I> + 1 HAMSTER SCIENTIST!
(random hero from isometric.spaceninja.com)



More information about the Zope mailing list