[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> </DIV>
<DIV>I have a folder (foo) which contains a set of DTML Documents, and =
instances=20
of a ZClass.</DIV>
<DIV> </DIV>
<DIV>From another DTML document, I enumerate the contents of this =
folder, using=20
a DTML-IN tag:</DIV>
<DIV> </DIV>
<DIV><dtml-in expr=3D"bar.foo.objectValues()" =
sort=3D"order"></DIV>
<DIV><FONT face=3DArial size=3D2>...</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></dtml-in></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>My problem is with ..., namely dealing =
with both=20
DTML documents and ZClasses. </FONT><FONT face=3DArial size=3D2>In =
the case of=20
DTML Documents, the following works fine:</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2><dtml-var =
sequence-item></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>In the case of ZClasses, I have to use =
something=20
like this:</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2><dtml-with =
sequence-item></FONT></DIV>
<DIV><FONT face=3DArial size=3D2> <dtml-var =
index_html></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></dtml-with></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>So I'm using this:</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2><dtml-if =
expr=3D"_['sequence-var-meta_type'] =3D=3D=20
'DTML Document'"><BR> <dtml-var=20
sequence-item><BR><dtml-else><BR> <dtml-with=20
sequence-item><BR> <dtml-var =
index_html><BR> =20
</dtml-with><BR></dtml-if></FONT></DIV>
<DIV> </DIV>
<DIV> </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> </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--