[Zope] traveese_subpath

Terry Hancock hancock at anansispaceworks.com
Thu Jan 22 22:44:35 EST 2004


On Thursday 22 January 2004 06:03 pm, J Cameron Cooper wrote:
> nwingfield at che-llp.com wrote:
> 
> >I am writing a custom product and would like to make use of the URL string
> >to do some cool stuff.  When writing a "Python Script" there is a handy
> >variable called traverse_subpath that contains the elements of the URL to
> >the right of the name of the script itself.  However, Zope tends to raise
> >an exception when I attempt this technique with other types of objects,
> >namely the objects created with my custom product code.

> under "traversal methods". By providing a __bobo_traverse__ you can stop 
> traversal and provide a traversal sub-path to your object, just like 
> Python scripts do. In fact, you can probably hunt that very code down 
> for inspiration. Probably it goes very much like::

I use this feature in my VarImage product.  You can download a copy of
version 2.3.1 from http://sourceforge.net/projects/narya-project or from
my own site at http://www.anansispaceworks.com/papers_html .  You'll
also note that I chose to use __getitem__  as well so that python code
can use the mapping syntax, like http://url/to/my_varimage['tn_100.jpg']

The REFERER blocking doesn't work quite like I want it to, but the __bobo_traverse__
call shows a typical application.

Cheers,
Terry

--
Terry Hancock ( hancock at anansispaceworks.com )
Anansi Spaceworks  http://www.anansispaceworks.com



More information about the Zope mailing list