<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 <<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>><br></div><pre><br>>> - --On 8. Dezember 2006 10:38:25 -0800 Javier Subervi<br>>> <<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>> wrote:<br>>><br>>>> <html><br>>>><br>>>> But when I try to make it work in an External Method
like this:<br>>>><br>>>> stuff = '<html>\n'<br>>>> stuff = stuff + '<body>\n'<br>>>> stuff = stuff + '<table width="100%" align="center" class="text"<br>>>> border="3" cellspacing="5" bgcolor="#E694FE" bordercolor="#D24BFA"<br>>>> bordercolorlight="#DD77FB" bordercolordark="#C512FA"><tr><td>\n' stuff<br>>>> = stuff + '<span<br>>>> metal:use-macro="here/en-us/Quotes/10/macros/quote"></span><br />\n'<br>>>> stuff = stuff + '<div align="center"><span class="text">\n'<br>>>> stuff = stuff + ' <a href="All_Quotes.pt" target="_top"><b>Show me all<br>>>> the quotes!</b></a>\n' stuff = stuff + '</span></div>\n'<br>>>> stuff = stuff + '</td></tr></table>\n'<br>>>> stuff = stuff + '</body>\n'<br>>>> stuff = stuff +
'<html>\n'<br>>><br>>> An external method is not a ZPT. The external method returns just HTML.<br>>> Why and how should Zope treat interpret <b>*something*</b> inside the HTML<br>>> generated by the external method as macro? If you want a macro, the<br>>> called object has to be a ZPT - nothing else.<br>>><br>>> - -aj<br>><br>>If you want something different: you must instantiate a Pagetemplate inside<br>>your external method, add the content through the related API and let the <br>>pagetemplate render the content. But there is usually no need for such an <br>>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 + '<span metal:use-macro="here/en-us/Quotes/' + `randrange(1, len(self.objectValues()), 1)` +
'/macros/quote"<br>></span><br />\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>