9 Dec
2002
9 Dec
'02
4:57 p.m.
Mikhail wrote:
<p metal:use-macro="python:here.getMacro()">
Can you explain this example and show simple script? """ return 'path/to/zpt/macros/some' """ don't work.
"getMacro" cannot return a string -- it must return the actual macro object. One way to accomplish this is to use the "restrictedTraverse" method on your path string, like so: return context.restrictedTraverse('path/to/library.zpt/macros/some') Slightly more efficient, if your path is static, would be the following: return context.path.to['library.zpt'].macros.some On the other hand, you *could* return a path string, if you change your use-macro to: <p metal:use-macro="python:path(here.getMacro())"> Cheers, Evan @ 4-am