<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><div><span idspanfor="frame" mlb_idspanflag="true" style="border: 1px solid black; padding: 0px 3px; z-index: 500; font-size: xx-small; font-family: sans-serif; background-color: rgb(214, 227, 254); position: absolute; top: 0pt; left: 0pt;">2</span>

<div class="headers">From: Andreas Jung &lt;<a target="_top" href="http://gmane.org/get-address.php?address=lists%2dqpoMQbdTBzkAvxtiuMwx3w%40public.gmane.org">lists@...<span idspanfor="link" mlb_idspanflag="true" style="border: 1px solid grey; padding: 0px 3px; float: none; margin-left: 3px; z-index: 500; font-size: xx-small; font-family: sans-serif; display: inline;">108</span></a>&gt;<br></div><pre><br>&gt;&gt; - --On 8. Dezember 2006 10:38:25 -0800 Javier Subervi<br>&gt;&gt; &lt;<a target="_top" href="http://gmane.org/get-address.php?address=javier%5fsubervi%2d%2fE1597aS9LQAvxtiuMwx3w%40public.gmane.org">javier_subervi@...<span idspanfor="link" mlb_idspanflag="true" style="border: 1px solid grey; padding: 0px 3px; float: none; margin-left: 3px; z-index: 500; font-size: xx-small; font-family: sans-serif; display: inline;">112</span></a>&gt; wrote:<br>&gt;&gt;<br>&gt;&gt;&gt; &lt;html&gt;<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; But when I try to make it work in an External Method
 like this:<br>&gt;&gt;&gt;<br>&gt;&gt;&gt;   stuff = '&lt;html&gt;\n'<br>&gt;&gt;&gt;   stuff = stuff + '&lt;body&gt;\n'<br>&gt;&gt;&gt;   stuff = stuff + '&lt;table width="100%" align="center" class="text"<br>&gt;&gt;&gt; border="3" cellspacing="5" bgcolor="#E694FE" bordercolor="#D24BFA"<br>&gt;&gt;&gt; bordercolorlight="#DD77FB" bordercolordark="#C512FA"&gt;&lt;tr&gt;&lt;td&gt;\n'   stuff<br>&gt;&gt;&gt; = stuff + '&lt;span<br>&gt;&gt;&gt; metal:use-macro="here/en-us/Quotes/10/macros/quote"&gt;&lt;/span&gt;&lt;br /&gt;\n'<br>&gt;&gt;&gt; stuff = stuff + '&lt;div align="center"&gt;&lt;span class="text"&gt;\n'<br>&gt;&gt;&gt;   stuff = stuff + ' &lt;a href="All_Quotes.pt" target="_top"&gt;&lt;b&gt;Show me all<br>&gt;&gt;&gt; the quotes!&lt;/b&gt;&lt;/a&gt;\n'   stuff = stuff + '&lt;/span&gt;&lt;/div&gt;\n'<br>&gt;&gt;&gt;   stuff = stuff + '&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;\n'<br>&gt;&gt;&gt;   stuff = stuff + '&lt;/body&gt;\n'<br>&gt;&gt;&gt;   stuff = stuff +
 '&lt;html&gt;\n'<br>&gt;&gt;<br>&gt;&gt; An external method is not a ZPT. The external method returns just HTML.<br>&gt;&gt; Why  and how should Zope treat interpret <b>*something*</b> inside the HTML<br>&gt;&gt; generated  by the external method as macro? If you want a macro, the<br>&gt;&gt; called object has  to be a ZPT - nothing else.<br>&gt;&gt;<br>&gt;&gt; - -aj<br>&gt;<br>&gt;If you want something different: you must instantiate a Pagetemplate inside<br>&gt;your external method, add the content through the related API and let the <br>&gt;pagetemplate render the content. But there is usually no need for such an <br>&gt;approach. Somehow you're trying to do something the wrong way round.<br><br><span style="font-family: times new roman,new york,times,serif;">What I'm trying to do is change the line in question to this:<br><br>  stuff = stuff + '&lt;span metal:use-macro="here/en-us/Quotes/' + `randrange(1, len(self.objectValues()), 1)` +
 '/macros/quote"<br>&gt;&lt;/span&gt;&lt;br /&gt;\n'<br> <br>So it generates a random number. Now, that's the "easy" scenario, and for that I originally had just a Page Template. However, next up I need to be able to accommodate another folder which requires:<br><br>1) walking the folder, opening each subfolder<br>2) creating a tuple of the folder (or numerical representation) plus the number of the quote<br>3) randomly choosing a quote from all the subfolders<br><br>Ideas? Perhaps I should instantiate a page template in the ext. method. How would I do that?<br>TIA,<br>Javier<br></span></pre></div></div><br>

<hr size=1>Check out <a href="http://us.rd.yahoo.com/evt=43257/*http://advision.webevents.yahoo.com/mailbeta">the all-new Yahoo! Mail beta</a> - Fire up a more powerful email and get things done faster.</body></html>