[Zope] referencing an object elsewhere in the tree

flynt flynt@gmx.ch
Fri, 23 Nov 2001 19:18:25 +0100


sirius legend wrote:
> 
> Hello,
> 
> I'm new to zope, and find it the best web application environment ;)
> 
> Have a little problem... Browsed thru the docs and mailing lists, but
> can't find any information on how can i refer to objects that are not in the
> acquistion path.
> 
> For example i build simple a shop, and have all shopping cart related
> dtml methods in /cart folder. In the cart's list method i'd like to include
> the icon, and other details can be found for example at
> /products/accessories/wallet/. Is there any way to do this?
> 
> Now I store string object id's in cart's session variables like
> '/products/bags/djbag'. It's the cart item's original path.
> I think I should be able to resolve the object from this id, but how?
> 
> There are also relations between products, like a products can
> be made from a list of materials, and that materials are also products.
> I tried to use ZCatalog to solve this, but it indexed only the current
> folder ( eg. /products/bags, but not the /products/materials ).
> 
> The layout:
> 
> /products/
>   materials/
>     natural1/
>       icon.gif,
>       etc...
>     natural2/
>     coloured/
>       black/
>       orange/
>       ...
> 
>   bags/
>     djbag/
>       ( here i'd like to have a manually edited list of links to materials )
>     backpack/
>     ...
> 
> /cart/
>   list
>     ( here i'd like to resolve object ids like /products/bags/dj )
>   edit
>   ...
> 
> Your help would be appreciated,
> 
>  martin
> 

Hi Martin

Are you aware of the <dtml-with> tag ? With this tag you can put a
certain folder on top of the namespace. For example:

<dtml-with "products.accessories.wallet">
   *call methods located in the folder wallet*
</dtml-with>

Regards

--- Flynt