[Zope] Disabling acquisition on a soft reference

Arian de Wit a.dewit@niwa.cri.nz
Wed, 5 Sep 2001 10:25:54 +1200


Hi All,

I'm setting up a site where the nav menu links are specified for 
each folder using a "menu" object. If it's not present in a folder, it 
will be acquired from further up, as usual.

For some pages within a folder, I'd like to use a page-specific menu 
and not the folder's one at all. To do this, I figured I'd create another 
menu object for that page object called "<pagename>.menu" and 
use a soft reference to render that in my standard_html_footer 
instead of rendering the folder's "menu" object.

So here's the bit of ugly DTML that I've got in my footer:

<div class="menu">
 <dtml-try>
  <dtml-with aq_explicit>
   <dtml-let spliturl="_.string.split(absolute_url(), '/')"
            menuname="spliturl[_.len(spliturl)-1:]+['menu']"
            menulink="_.string.join(menuname, '.')">
    <dtml-var expr="_[menulink]">
   </dtml-let>
  </dtml-with>
 <dtml-except>
  <dtml-var menu>
 </dtml-try>
</div> <!-- menu -->

It constructs what the name of the page-specific menu would be for 
this page (in the variable menulink) then uses that in the soft 
reference _[menulink].

Unfortunately, when rendering a page called, say, index.html it will 
acquire index.html.menu from further up the tree if not available in 
the page's own folder, even though I have wrapped this all up in 
<dtml-with aq_explicit> to supposedly disable acquisition.

I'm obviously missing a subtlety here -- any ideas? I'd especially 
like to know if there's a much simpler way to do all this and I'm just 
being thick.


Thanks a lot,

Arian

 
 ------------------------------------------------------------------
Arian de Wit
Information Systems Integration Manager
NIWA (National Institute of Water & Atmospheric Research)
Gate 10 Silverdale Road, Box 11-115, Hamilton, New Zealand 2001
Phone  (+64) 7-856 1769
Fax    (+64) 7-856 0151
Web    http://www.niwa.co.nz
 ------------------------------------------------------------------