Problem using ExternalFile with METAL macro
I'm unable to get ExternalFile to work with macros within page templates and I'm hoping that some of you have solved this problem. I'm a newbie to Zope, so it's quite possible it's my error, but I've been struggling with this for a while & haven't been able to find anything online about my problem. I have an ExternalFile set to behave like a page template called index_html and it calls a macro, m1, in another ExternalFile, mac1, which is also set to behave like a pt. In brief I get the following error: Error Type: AttributeError Error Value: macros Note that if the same macro is included in a "real" page template, no error occurs. Likewise an error occurs regardless of whether index_html is a "real" pt or an ExternalFile behaving like one. I've included the files themselves and the traceback from the error_log below. index_html: <html> <head> <title tal:content="template/title">The title</title> </head> <body> <table metal:use-macro="here/mac1/macros/m1"></table> </body> </html> mac1: <div id="footer" metal:define-macro="m1" > hello, world </div> Traceback (innermost last): * Module ZPublisher.Publish, line 98, in publish * Module ZPublisher.mapply, line 88, in mapply * Module ZPublisher.Publish, line 39, in call_object * Module Products.ExternalFile.ExternalFile, line 404, in __call__ * Module Shared.DC.Scripts.Bindings, line 306, in __call__ * Module Shared.DC.Scripts.Bindings, line 343, in _bindAndExec * Module Products.PageTemplates.ZopePageTemplate, line 228, in _exec * Module Products.PageTemplates.PageTemplate, line 95, in pt_render <ZopePageTemplate at /Loomia/index_html/index_html> * Module TAL.TALInterpreter, line 200, in __call__ * Module TAL.TALInterpreter, line 244, in interpret * Module TAL.TALInterpreter, line 689, in do_useMacro * Module Products.PageTemplates.TALES, line 220, in evaluate URL: index_html Line 6, Column 4 Expression: standard:'here/mac1/macros/m1' Names: {'container': <ExternalFile at /Loomia/index_html>, 'default': <Products.PageTemplates.TALES.Default instance at 0x86d5174>, 'here': <ExternalFile at /Loomia/index_html>, 'loop': <SafeMapping instance at 8e0ac00>, 'modules': <Products.PageTemplates.ZRPythonExpr._SecureModuleImporter instance at 0x86d527c>, 'nothing': None, 'options': {'args': (<ExternalFile at /Loomia/index_html>, <HTTPRequest, URL=http://localhost:8080/Loomia/index_html>)}, 'repeat': <SafeMapping instance at 8e0ac00>, 'request': <HTTPRequest, URL=http://localhost:8080/Loomia/index_html>, 'root': <Application instance at 8e0fc60>, 'template': <ZopePageTemplate at /Loomia/index_html/index_html>, 'traverse_subpath': [], 'user': francis} * Module Products.PageTemplates.Expressions, line 201, in __call__ * Module Products.PageTemplates.Expressions, line 189, in _eval * Module Products.PageTemplates.Expressions, line 145, in _eval __traceback_info__: here * Module Products.PageTemplates.Expressions, line 355, in restrictedTraverse __traceback_info__: {'path': ['mac1', 'macros', 'm1'], 'TraversalRequestNameStack': ['m1']} I'm running ExternalFile 1.2, with Zope 2.6 on a box running roughly the latest version of SuSE Linux, and Python 2.1.3. Any insight you have into this problem would be most appreciated. Thanks, Francis Kelly zope@crubellier.com
Francis Kelly wrote at 2004-2-18 14:25 -0800:
... I have an ExternalFile set to behave like a page template called index_html and it calls a macro, m1, in another ExternalFile, mac1, which is also set to behave like a pt. In brief I get the following error:
Error Type: AttributeError Error Value: macros
This looks like a bug in the wrapping of an ExternalFile by a PageTemplate: apparently a call to "cook" (or similar) is missing. -- Dieter
participants (2)
-
Dieter Maurer -
Francis Kelly