[Zope] boolean dtml solution!

Leigh Ann Hildebrand leighann@onebox.com
Tue, 03 Jul 2001 18:12:16 -0700


First, I want to thank everyone who sent email and worked on this problem
with me. I've got a solution to report!

If you'll remember, the original dtml method looked like this:

<dtml-in expr="_[foldername].objectValues()"
 sort="bobobase_modification_time" reverse>
<dtml-unless "_['id']=='index_html'">
<li>
<a href="<dtml-var absolute_url>"><dtml-var title></a><br>
</dtml-unless>
</dtml-in>

When I changed the unless to <dtml-unless index_hide>, it didn't work,
because nothing was listed. 

After trying several Python scripts and other suggestions, I asked the
very wise rdmurray of #zope if I should change the method completely.
We'd already discussed the likelihood of this being a problem with acquisition;
in reviewing my dtml method and other information further, he noticed
something I'd been leaving out of my explanations. To quote: 

"Ok, my *guess* is that your problem arose from the fact that your
index_html seems to be a DTML Document, since it has a property
foldername.  I'm guessing that when you tried the index_hide property
experiment you naturally set index_hide on the index_html.  But since
it is a Document, anything called inside it acquires from it,
so the hidden property got acquired."

His guess was absolutely correct, and that was the problem. When I set
my boolean dtml-unless, that's exactly what I'd done. 

Once that was figured out, the solution was easy: my index_html should
always be a method, not a document. Once I corrected that, the problem
was mostly fixed. I say *mostly*, because there was one thing left: with
index_html now a method, I couldn't set the index_hide property on *it*,
so it was showing up in my dynamic index listing. 

To fix this, and because I never need to list a method in my document
indexes, I've excluded meta_type "DTML Method". So, here's the solution
I'm now using: 

<UL>
<dtml-in expr="objectValues()" sort="bobobase_modification_time" reverse>
<dtml-if "meta_type!='DTML Method'">
<dtml-unless index_hide>
<li>
<a href="<dtml-var absolute_url>"><dtml-var title></a><br>
</dtml-unless>
</dtml-if>
</dtml-in>
</UL>

Of course, one could solve this in other ways, and with a little tighter
dtml, almost certainly. This solution works for me because I understand
it and can modify it later if I need to. Many suggestions I got seemed
great, except for being beyond my current capabilities. One of the standards
I've set for my zope right now is that I not clip or use dtml or python
that I don't understand well enough to modify, etc. 

Anyway, thanks again for all the assistance!

Leigh Ann
-- 
Leigh Ann Hildebrand
leighann@onebox.com - email
(650) 223-2199 x2231 - voicemail/fax



__________________________________________________
FREE voicemail, email, and fax...all in one place.
Sign Up Now! http://www.onebox.com