-----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 <gaute@div.org> 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 tseaver@palladion.com 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-----