[Grok-dev] a problem with 'static' and macros
faassen at startifact.com
Tue May 22 19:56:56 EDT 2007
I have discovered a problem with the combination of the 'static'
variable in page templates in combination with macros.
'static' is a special variable that Grok makes available to page
templates. It makes it easy to refer to static resources in the
package's 'static' directory:
<img tal:attributes="src static/myimage.jpg" />
Now put the above line in a macro. Now put the macro in one package, and
the page template that uses this macro in another package.
When the second page template is rendered, the 'static' in the macro
will reference the static directory in the *new* package, not the
package the macro itself is in. This is unexpected, as it disallows the
reuse of macros from other packages if they refer to static resources at
We need a solution to this problem. I am at a loss; macros just work
this way with names, after all. Is it possible to have a "macro-local"
name only dependent on the view of the macro itself? I have no idea how.
Anyone got any ideas?
More information about the Grok-dev