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