I never thank I can do that with a macro. I always use the standard way, like Tonico wrote. I learnt something :)<br><br>
<div><span class="gmail_quote">2007/3/2, Tres Seaver <<a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:tseaver@palladion.com" target="_blank">tseaver@palladion.com</a>>:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">-----BEGIN PGP SIGNED MESSAGE-----<br>Hash: SHA1<br><br>Gaute Amundsen wrote:<br>> On Friday 02 March 2007 11:20, Andreas Jung wrote:
<br>>> --On 2. März 2007 11:10:57 +0100 Gaute Amundsen <<a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:gaute@div.org" target="_blank">gaute@div.org</a>> wrote:<br>>>> I have tried many varieties, but I can't remember ever getting it to
<br>>>> work... <br>>>><br>>>> A few googles shows me nothing either.<br>>> returning a macro?<br>>><br>>> -aj<br>><br>> Something like this:<br>><br>> foo = restrictedTraverse('/foo/bar/index.html/macros/mymacro')
<br>> return foo()<br>><br>> But of course foo is a list, and I can't see a way I can use any of the<br>> contents..<br><br>You can't "use it", only inline it into a calling template. E.g.:<br>
<br>##Script (Python) "random_macro"<br>from random import choice # may need module security assertion<br>macros = context.some_template.macros<br>macro1 = macros['one']<br>macro2 = macros['two']
<br>macro3 = macros['three']<br>return choice((macro1, macro2, macro3))<br><br>The template would just do:<br><br> <div metal:use-macro="context/random_macro" /><br><br><br><br>Tres.<br>- --<br>===================================================================
<br>Tres Seaver +1 540-429-0999 <a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:tseaver@palladion.com" target="_blank">tseaver@palladion.com</a><br>Palladion Software "Excellence by Design"
<a onclick="return top.js.OpenExtLink(window,event,this)" href="http://palladion.com/" target="_blank">http://palladion.com </a><br>-----BEGIN PGP SIGNATURE-----<br>Version: GnuPG v1.4.2.2 (GNU/Linux)<br>Comment: Using GnuPG with Mozilla -
<a onclick="return top.js.OpenExtLink(window,event,this)" href="http://enigmail.mozdev.org/" target="_blank">http://enigmail.mozdev.org</a><br><br>iD8DBQFF6Euf+gerLs4ltQ4RAlAvAKC1OUUAyTTh5mcJ+WN9ljLQq7eQfQCfeSmv <br>pKeYt4iwEPMdleU5ef9D5Nc=
<br>=fNnX<br>-----END PGP SIGNATURE-----<br><br>_______________________________________________<br>Zope maillist - <a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:Zope@zope.org" target="_blank">Zope@zope.org
</a><br><a onclick="return top.js.OpenExtLink(window,event,this)" href="http://mail.zope.org/mailman/listinfo/zope" target="_blank">http://mail.zope.org/mailman/listinfo/zope</a><br>** No cross posts or HTML encoding! **
<br>(Related lists -<br><a onclick="return top.js.OpenExtLink(window,event,this)" href="http://mail.zope.org/mailman/listinfo/zope-announce" target="_blank">http://mail.zope.org/mailman/listinfo/zope-announce </a><br><a onclick="return top.js.OpenExtLink(window,event,this)" href="http://mail.zope.org/mailman/listinfo/zope-dev" target="_blank">
http://mail.zope.org/mailman/listinfo/zope-dev</a> )<br></blockquote></div><br><br clear="all"><br>-- <br>J. Prudent