[Zope] Recursive Calling the same DTML Method is not validate d?

oliver.erlewein@sqs.de oliver.erlewein@sqs.de
Tue, 30 Oct 2001 09:50:39 +0100


This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C1611F.F3532F00
Content-Type: text/plain;
	charset="iso-8859-1"

Hi

Normally you would call the recursive method  form a DTML Source. In this
source you would write <dtml-let aa=0><dtml-var a></dtml-let>. This gives
you a "global" variable. I used it and it works. I would also suggest to use
external Python for recursion because DTML-recursion is VERY slow!

Regards
Oliver

-----Original Message-----
From: iap@y2fun.com [mailto:iap@y2fun.com]
Sent: Tuesday, October 30, 2001 9:33 AM
To: zope@zope.org
Subject: [Zope] Recursive Calling the same DTML Method is not validated?


Suppose we have a DTML Method named "A"
---------------------------------------------------------
<dtml-unless "REQUEST.has_key('aa')">
    <dtml-call "REQUEST.set('aa',0)">
</dtml-unless>

<dtml-call "REQUEST.set('aa',REQUEST['aa']+1)">
<dtml-var "REQUEST['aa']">

<dtml-if "REQUEST['aa']>10">
   <dtml-return "''"><dtml-comment>Stop here</dtml-comment>
<dtml-else>
   <dtml-var A><dtml-comment>Go deeper</dtml-comment>
</dtml-if>
---------------------------------------------------------
Excute it, then got the result:

Error Type: KeyError
Error Value: validate
---------------------------------------------------------
This is a sample method abstracted from my another more complex method
which works in the previous version of Zope.
I know that there are something changed in the SecurityManager.
But I have no idea how to make this sort of recursive method works again.
Any suggestion?
Thanks.
Iap, Singuan



_______________________________________________
Zope maillist  -  Zope@zope.org
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )

------_=_NextPart_001_01C1611F.F3532F00
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
5.5.2653.12">
<TITLE>RE: [Zope] Recursive Calling the same DTML Method is not =
validated?</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=3D2>Hi</FONT>
</P>

<P><FONT SIZE=3D2>Normally you would call the recursive method&nbsp; =
form a DTML Source. In this source you would write &lt;dtml-let =
aa=3D0&gt;&lt;dtml-var a&gt;&lt;/dtml-let&gt;. This gives you a =
&quot;global&quot; variable. I used it and it works. I would also =
suggest to use external Python for recursion because DTML-recursion is =
VERY slow!</FONT></P>

<P><FONT SIZE=3D2>Regards</FONT>
<BR><FONT SIZE=3D2>Oliver</FONT>
</P>

<P><FONT SIZE=3D2>-----Original Message-----</FONT>
<BR><FONT SIZE=3D2>From: iap@y2fun.com [<A =
HREF=3D"mailto:iap@y2fun.com">mailto:iap@y2fun.com</A>]</FONT>
<BR><FONT SIZE=3D2>Sent: Tuesday, October 30, 2001 9:33 AM</FONT>
<BR><FONT SIZE=3D2>To: zope@zope.org</FONT>
<BR><FONT SIZE=3D2>Subject: [Zope] Recursive Calling the same DTML =
Method is not validated?</FONT>
</P>
<BR>

<P><FONT SIZE=3D2>Suppose we have a DTML Method named =
&quot;A&quot;</FONT>
<BR><FONT =
SIZE=3D2>---------------------------------------------------------</FONT=
>
<BR><FONT SIZE=3D2>&lt;dtml-unless =
&quot;REQUEST.has_key('aa')&quot;&gt;</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp; &lt;dtml-call =
&quot;REQUEST.set('aa',0)&quot;&gt;</FONT>
<BR><FONT SIZE=3D2>&lt;/dtml-unless&gt;</FONT>
</P>

<P><FONT SIZE=3D2>&lt;dtml-call =
&quot;REQUEST.set('aa',REQUEST['aa']+1)&quot;&gt;</FONT>
<BR><FONT SIZE=3D2>&lt;dtml-var &quot;REQUEST['aa']&quot;&gt;</FONT>
</P>

<P><FONT SIZE=3D2>&lt;dtml-if =
&quot;REQUEST['aa']&gt;10&quot;&gt;</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp; &lt;dtml-return =
&quot;''&quot;&gt;&lt;dtml-comment&gt;Stop =
here&lt;/dtml-comment&gt;</FONT>
<BR><FONT SIZE=3D2>&lt;dtml-else&gt;</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp; &lt;dtml-var =
A&gt;&lt;dtml-comment&gt;Go deeper&lt;/dtml-comment&gt;</FONT>
<BR><FONT SIZE=3D2>&lt;/dtml-if&gt;</FONT>
<BR><FONT =
SIZE=3D2>---------------------------------------------------------</FONT=
>
<BR><FONT SIZE=3D2>Excute it, then got the result:</FONT>
</P>

<P><FONT SIZE=3D2>Error Type: KeyError</FONT>
<BR><FONT SIZE=3D2>Error Value: validate</FONT>
<BR><FONT =
SIZE=3D2>---------------------------------------------------------</FONT=
>
<BR><FONT SIZE=3D2>This is a sample method abstracted from my another =
more complex method</FONT>
<BR><FONT SIZE=3D2>which works in the previous version of Zope.</FONT>
<BR><FONT SIZE=3D2>I know that there are something changed in the =
SecurityManager.</FONT>
<BR><FONT SIZE=3D2>But I have no idea how to make this sort of =
recursive method works again.</FONT>
<BR><FONT SIZE=3D2>Any suggestion?</FONT>
<BR><FONT SIZE=3D2>Thanks.</FONT>
<BR><FONT SIZE=3D2>Iap, Singuan</FONT>
</P>
<BR>
<BR>

<P><FONT =
SIZE=3D2>_______________________________________________</FONT>
<BR><FONT SIZE=3D2>Zope maillist&nbsp; -&nbsp; Zope@zope.org</FONT>
<BR><FONT SIZE=3D2><A =
HREF=3D"http://lists.zope.org/mailman/listinfo/zope" =
TARGET=3D"_blank">http://lists.zope.org/mailman/listinfo/zope</A></FONT>=

<BR><FONT SIZE=3D2>**&nbsp;&nbsp; No cross posts or HTML =
encoding!&nbsp; **</FONT>
<BR><FONT SIZE=3D2>(Related lists - </FONT>
<BR><FONT SIZE=3D2>&nbsp;<A =
HREF=3D"http://lists.zope.org/mailman/listinfo/zope-announce" =
TARGET=3D"_blank">http://lists.zope.org/mailman/listinfo/zope-announce</=
A></FONT>
<BR><FONT SIZE=3D2>&nbsp;<A =
HREF=3D"http://lists.zope.org/mailman/listinfo/zope-dev" =
TARGET=3D"_blank">http://lists.zope.org/mailman/listinfo/zope-dev</A> =
)</FONT>
</P>

</BODY>
</HTML>
------_=_NextPart_001_01C1611F.F3532F00--