[Zope] ZClass/DTML Document transparency

Randall Kern randy@teamkern.net
Mon, 20 Nov 2000 17:52:33 -0800


This is a multi-part message in MIME format.

------=_NextPart_000_06AE_01C0531A.A8FCAA80
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi all,

I have a folder (foo) which contains a set of DTML Documents, and =
instances of a ZClass.

From another DTML document, I enumerate the contents of this folder, =
using a DTML-IN tag:

<dtml-in expr=3D"bar.foo.objectValues()" sort=3D"order">
...
</dtml-in>

My problem is with ..., namely dealing with both DTML documents and =
ZClasses.  In the case of DTML Documents, the following works fine:

<dtml-var sequence-item>

In the case of ZClasses, I have to use something like this:

<dtml-with sequence-item>
  <dtml-var index_html>
</dtml-with>

So I'm using this:

<dtml-if expr=3D"_['sequence-var-meta_type'] =3D=3D 'DTML Document'">
  <dtml-var sequence-item>
<dtml-else>
  <dtml-with sequence-item>
    <dtml-var index_html>
  </dtml-with>
</dtml-if>


But this is rather ugly, and it's the sort of thing one shouldn't have =
to do in an oo system.

So, is there a better way?
-Randy

------=_NextPart_000_06AE_01C0531A.A8FCAA80
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2920.0" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV>Hi all,</DIV>
<DIV>&nbsp;</DIV>
<DIV>I have a folder (foo) which contains a set of DTML Documents, and =
instances=20
of a ZClass.</DIV>
<DIV>&nbsp;</DIV>
<DIV>From another DTML document, I enumerate the contents of this =
folder, using=20
a DTML-IN tag:</DIV>
<DIV>&nbsp;</DIV>
<DIV>&lt;dtml-in expr=3D"bar.foo.objectValues()" =
sort=3D"order"&gt;</DIV>
<DIV><FONT face=3DArial size=3D2>...</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&lt;/dtml-in&gt;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>My problem is with ..., namely dealing =
with both=20
DTML documents and ZClasses.&nbsp; </FONT><FONT face=3DArial size=3D2>In =
the case of=20
DTML Documents, the following works fine:</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&lt;dtml-var =
sequence-item&gt;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>In the case of ZClasses, I have to use =
something=20
like this:</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&lt;dtml-with =
sequence-item&gt;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp; &lt;dtml-var =
index_html&gt;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&lt;/dtml-with&gt;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>So I'm using this:</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&lt;dtml-if =
expr=3D"_['sequence-var-meta_type'] =3D=3D=20
'DTML Document'"&gt;<BR>&nbsp; &lt;dtml-var=20
sequence-item&gt;<BR>&lt;dtml-else&gt;<BR>&nbsp; &lt;dtml-with=20
sequence-item&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;dtml-var =
index_html&gt;<BR>&nbsp;=20
&lt;/dtml-with&gt;<BR>&lt;/dtml-if&gt;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>But this is rather ugly, and it's the =
sort of thing=20
one shouldn't have to do in an oo system.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>So, is there a better way?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>-Randy</FONT></DIV></BODY></HTML>

------=_NextPart_000_06AE_01C0531A.A8FCAA80--