[Zope] FQ Path Names in container

Roy Rapoport r.rapoport@fi.com
Wed Aug 6 19:15:52 EDT 2003


> If you want to get substructures in Python, you can do one of 
> these things:
> 
> container.A.B.C   # can't go to something with a dot in the name
> container.A.B['C.pdf']
> container['A']['B']['C.pdf']
> container.restrictedTraverse('A/B/C.pdf')
> 
> Restricted traverse is probably the best way to deal with a variable 
> path, as you seem to have.
> 
> See also:
> http://www.zopelabs.com/cookbook/1001104105
> http://www.zopelabs.com/cookbook/1032051886

Apologies, a typo in my original example made my problem less clear.

I have  no problem accessing a given file, even if it has a .extension; my
problem is trying to figure out how to do traversal and require it to be
from the root folder, rather starting at the current directory.  In other
words, yes, I can do this:
container.restrictedTraverse('A/B/C.pdf')
But what I want to be able to do is:
container.restrictedTraverse('/A/B/C.pdf').  Note the leading '/' before 'A'

And, err, 'nevermind' -- I figured I might as well trawl ZopeLabs (I didn't
know about them until you sent the links above), and found 'get Root
Object', cookbook recipe #994090604.  That should do the trick.

Thanks!

-roy


Content-Type: text/plain;
	charset="iso-8859-1"
 




-------------------------------------------------
PLEASE READ THIS WARNING: All e-mail sent to or from this address will be
received or otherwise recorded by the Fisher Investments  corporate e-mail
system and is  subject to archival, monitoring or review by, and/or
disclosure to, someone other than the recipient.





More information about the Zope mailing list