[Zope] - Food for thought

Jim Fulton jim.fulton@digicool.com
Mon, 28 Dec 1998 12:57:20 -0500


Scott Robertson wrote:
> 
> I'm not quite sure that there really is a solution for this problem, so I
> didn't add it to the bug list, but it is something to think about.
> 
> Can ayone think of a good way to keep DTML from infinetly looping?

DTML tries to catch infinate loops.  DT_String raises an 
error if it detects that the call level is greater than 200.

> We would like to be able to offer the zope managment screens to our
> customers, unfortunatly we discovered it's real easy to lock the server up
> with a little bit of DTML.
> 
> For exaple.
> 
> Create a folder and place a document method in it
> and call it index_html. Place this line in the index html file.
> 
> <!--#tree-->
> <!--#var index_html-->
> <!--#/tree-->
> 
> Then add one sub folder with nothing in it so that this folder will aquire
> the index_html method from the parent folder.
> 
> Preheat your oven to 350, and view your document.
> 
> Presto your Zope is cooked!

I can't reproduce this.

I created a folder, 'test', which contained a single 
document index_html containing the text above
and a single empty folder, 'f'.

Going to .../test/f gives an empty table.

Going to .../test, the site takes a long time
(depending on how fast the machine is :)
to return an error page with the error:

"infinite recursion in document template"

This error is hidden in a comment, in a page that looks like:

<HTML><HEAD><TITLE>test</TITLE> <base href="http://glebe:9673/test/">
</HEAD><BODY BGCOLOR="#FFFFFF">
<TABLE BORDER="0" WIDTH="100%">
<TR>
  <TD WIDTH="10%" ALIGN="CENTER">
  <STRONG><FONT SIZE="+6" COLOR="#77003B">!</FONT></STRONG>
  </TD>
  <TD WIDTH="90%"><BR>
  <FONT SIZE="+2">Zope Unavailable</FONT>
  <P>This Zope site is currently experiencing technical difficulties. 
Please contact the site administrator for more information.  For
additional technical information, please refer to the HTML source for this
page.  Thank you for your patience.</P>
  </TD>
</TR>
</TABLE>
<!--
 Error type:  
 Error value: infinite recursion in document template
 -->
</BODY></HTML>
<!--
Traceback (innermost last):
  File C:\Program Files\WebSite\lib\python\ZPublisher\Publish.py, line 879, in publish_module
  File C:\Program Files\WebSite\lib\python\ZPublisher\Publish.py, line 595, in publish
    (Info: /test/)
  File C:\Program Files\WebSite\lib\python\OFS\Document.py, line 181, in __call__
    (Object: index_html)
  File C:\Program Files\WebSite\lib\python\OFS\Document.py, line 177, in __call__
    (Object: index_html)
  File C:\Program Files\WebSite\lib\python\DocumentTemplate\DT_String.py, line 514, in __call__
    (Object: index_html)
  File C:\Program Files\WebSite\lib\python\TreeDisplay\TreeTag.py, line 166, in render
    (Object: a tree tag)
  File C:\Program Files\WebSite\lib\python\TreeDisplay\TreeTag.py, line 256, in tpRender
    (Object: Navigation)
  File C:\Program Files\WebSite\lib\python\TreeDisplay\TreeTag.py, line 493, in tpRenderTABLE
    (Object: Navigation)
    (Info: ([103, []], {'childless_decoration': '', 'id': 'tpId', 'branches': 'tpValues', 'url': 'tpURL'}, [[103, []]], [[103, []]]))
  File C:\Program Files\WebSite\lib\python\TreeDisplay\TreeTag.py, line 412, in tpRenderTABLE
    (Object: Navigation)
  File C:\Program Files\WebSite\lib\python\OFS\Document.py, line 173, in __call__
    (Object: index_html)
  File C:\Program Files\WebSite\lib\python\DocumentTemplate\DT_String.py, line 514, in __call__
    (Object: index_html)
  File C:\Program Files\WebSite\lib\python\TreeDisplay\TreeTag.py, line 166, in render

and so on.

I'm not sure why it takes so long for this to be returned.  I guess that the
tree tag does alot of computation in each iteration.

The site responds normally after handling this request.

I suppose we could make the recursion criteria lower 
(than 200) or make it configurable in some fashion.

Jim

--
Jim Fulton           mailto:jim@digicool.com
Technical Director   (888) 344-4332              Python Powered!
Digital Creations    http://www.digicool.com     http://www.python.org

Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email
address may not be added to any commercial mail list with out my
permission.  Violation of my privacy with advertising or SPAM will
result in a suit for a MINIMUM of $500 damages/incident, $1500 for
repeats.