Re: [Zope3-Users] Problem with macro
Am Sonntag, 25. Februar 2007 15:03 schrieb Marius Gedminas: On Sun, Feb 25, 2007 at 02:02:43PM +0100, Florian Lindner wrote: I have a simple problem. A template: html metal:use-macro=views/standard_macros/view i18n:domain=xgm.de/Blog body metal:block metal:define-macro=Blog metal:block metal:fill-slot=body h1 tal:content=context/title / div tal:replace=context/description / [...] /div /metal:block /metal:block /body /html That is registered as view.html. How? browser:page name=view.html template=foo.pt / ? Now I want to use the macro in another page: div metal:use-macro=context/Blog/@@view.html/Blog / (tried different variations) Ah, but did you try metal:use-macro=context/Blog/@@view.html/index/macros/Blog / No, have not tried it yet. But div metal:use-macro=context/Blog/@@view.html/index/macros/Blog / gives an error too: File /home/florian/Zope3/src/zope/tales/expressions.py, line 124, in _eval ob = self._traverser(ob, element, econtext) File /home/florian/Zope3/src/zope/app/pagetemplate/engine.py, line 65, in __call__ object = object[name] KeyError: 'Blog' Blog in a object contained by the xgm object. Blog is object that has the view.html registered. Thanks, Florian ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Problem with macro
On Mon, Feb 26, 2007 at 02:40:13PM +0100, Florian Lindner wrote: Am Sonntag, 25. Februar 2007 15:03 schrieb Marius Gedminas: On Sun, Feb 25, 2007 at 02:02:43PM +0100, Florian Lindner wrote: I have a simple problem. A template: html metal:use-macro=views/standard_macros/view i18n:domain=xgm.de/Blog body metal:block metal:define-macro=Blog ... That is registered as view.html. Now I want to use the macro in another page: div metal:use-macro=context/Blog/@@view.html/Blog / (tried different variations) Ah, but did you try metal:use-macro=context/Blog/@@view.html/index/macros/Blog / No, have not tried it yet. But div metal:use-macro=context/Blog/@@view.html/index/macros/Blog / gives an error too: File /home/florian/Zope3/src/zope/tales/expressions.py, line 124, in _eval ob = self._traverser(ob, element, econtext) File /home/florian/Zope3/src/zope/app/pagetemplate/engine.py, line 65, in __call__ object = object[name] KeyError: 'Blog' Blog in a object contained by the xgm object. Blog is object that has the view.html registered. Do you know which 'Blog' is the one that gives you the error? The macro or the item on 'context'? It could very well be that your define-macro doesn't take effect, because it is inside a use-macro and outside any fill-slot. Marius Gedminas -- Lost packet, 42 bytes, last seen on a saturated OC3, reward $$$. -- Eric^2 on Slashdot signature.asc Description: Digital signature ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Problem with macro
Am Montag, 26. Februar 2007 18:14 schrieb Marius Gedminas: On Mon, Feb 26, 2007 at 02:40:13PM +0100, Florian Lindner wrote: Am Sonntag, 25. Februar 2007 15:03 schrieb Marius Gedminas: On Sun, Feb 25, 2007 at 02:02:43PM +0100, Florian Lindner wrote: I have a simple problem. A template: html metal:use-macro=views/standard_macros/view i18n:domain=xgm.de/Blog body metal:block metal:define-macro=Blog ... That is registered as view.html. Now I want to use the macro in another page: div metal:use-macro=context/Blog/@@view.html/Blog / (tried different variations) Ah, but did you try metal:use-macro=context/Blog/@@view.html/index/macros/Blog / No, have not tried it yet. But div metal:use-macro=context/Blog/@@view.html/index/macros/Blog / gives an error too: File /home/florian/Zope3/src/zope/tales/expressions.py, line 124, in _eval ob = self._traverser(ob, element, econtext) File /home/florian/Zope3/src/zope/app/pagetemplate/engine.py, line 65, in __call__ object = object[name] KeyError: 'Blog' Blog in a object contained by the xgm object. Blog is object that has the view.html registered. Do you know which 'Blog' is the one that gives you the error? The macro or the item on 'context'? It could very well be that your define-macro doesn't take effect, because it is inside a use-macro and outside any fill-slot. It's probably that. I've changed the Blog macro to BlogMacro und now it complains abobut BlogMacro being missing. How would you do that? (for explanation what I want see my original posting) Thanks, Florian ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Problem with macro
Florian Lindner a écrit : Hello, I have a simple problem. A template: html metal:use-macro=views/standard_macros/view i18n:domain=xgm.de/Blog body metal:block metal:define-macro=Blog metal:block metal:fill-slot=body h1 tal:content=context/title / div tal:replace=context/description / [...] /div /metal:block /metal:block /body /html I'm not good with METAL (I'm trying to mainly use viewlets), but is it really valid to have use-macro and define-macro in the same template? I'm only using define-macro followed by define-slot, or use-macro followed by fill-slot. Is it possible to mix all this? Christophe That is registered as view.html. Now I want to use the macro in another page: div metal:use-macro=context/Blog/@@view.html/Blog / (tried different variations) but that always causes a system error because the macro could not be found. Thanks, Florian ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Problem with macro
On Sun, Feb 25, 2007 at 02:02:43PM +0100, Florian Lindner wrote: I have a simple problem. A template: html metal:use-macro=views/standard_macros/view i18n:domain=xgm.de/Blog body metal:block metal:define-macro=Blog metal:block metal:fill-slot=body h1 tal:content=context/title / div tal:replace=context/description / [...] /div /metal:block /metal:block /body /html That is registered as view.html. How? browser:page name=view.html template=foo.pt / ? Now I want to use the macro in another page: div metal:use-macro=context/Blog/@@view.html/Blog / (tried different variations) Ah, but did you try metal:use-macro=context/Blog/@@view.html/index/macros/Blog / ? When you attach a page template to a view with ZCML, it defines a view attribute 'index' behind the scenes. So, @@view.html refers to the view, @@view.html/index revers to the template, and @@view.html/index/macros refers to the macros defined in that template. Marius Gedminas -- For every complex problem, there is a solution that is simple, neat, and wrong signature.asc Description: Digital signature ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users