Re: [Zope-CMF] Accessing PageMacros
Am 11.03.2010, 17:15 Uhr, schrieb Charlie Clark : > I understand that and I've even had some success registering macros "the > Zope 3 way" - although I'm not sure that I see any advantage this way to > what you propose. However, zope.formlib.form.PageForm comes with it's own > template which has macros and slots which I like to be able to use and > the > default __call__ will use this template or a replacement one defined in a > View class template attribute. And it's creating a template that uses > zope.formlib.form.default_page_template where I'm stuck. hm, seems that Maurits has already solved this problem: http://maurits.vanrees.org/weblog/archive/2007/11/search-forms-with-zope-formlib-and-batching Solution: assign the standard template to another class variable which can then be accessed from the new template in the view. I think this is probably one of the examples of Zope 3's tendency to indirection getting out of hand: NamedTemplates exist, in theory, to separate BrowserViews from their templates. :-/ Personally I think this is overkill especially as the original adapter has to be registered again although I have no idea why this has to happen. The pattern class MyView(BrowserView) template = ViewPageTemplateFile(...) in the rare cases where templates are defined in the view class, a perfectly reasonable approach. But thanks very much to Maurits for showing the way. It may be worth noting that the example uses NamedTemplate with impunity in a Zope 2 context. Maybe five.formlib.formbase.FiveFormlibMixin can do without the hardcoded zope.formlib.__file__ template definitions and just worry about character encoding? Charlie -- Charlie Clark Helmholtzstr. 20 Düsseldorf D- 40215 Tel: +49-211-938-5360 GSM: +49-178-782-6226 ___ Zope-CMF maillist - Zope-CMF@zope.org https://mail.zope.org/mailman/listinfo/zope-cmf See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests
Re: [Zope-CMF] Accessing PageMacros
Am 11.03.2010, 16:19 Uhr, schrieb Andrew Sawyers : > Heya Charlie, > The way I do this is register a view for * with the name I'm using for > the > macro: > for="*" > name="foo" > permission="zope2.View" > template="../path/to/my_template.pt" > /> > Then in in the template: > > Not sure if that's the SOP or what...but works for me. Hi, I understand that and I've even had some success registering macros "the Zope 3 way" - although I'm not sure that I see any advantage this way to what you propose. However, zope.formlib.form.PageForm comes with it's own template which has macros and slots which I like to be able to use and the default __call__ will use this template or a replacement one defined in a View class template attribute. And it's creating a template that uses zope.formlib.form.default_page_template where I'm stuck. Charlie -- Charlie Clark Helmholtzstr. 20 Düsseldorf D- 40215 Tel: +49-211-938-5360 GSM: +49-178-782-6226 ___ Zope-CMF maillist - Zope-CMF@zope.org https://mail.zope.org/mailman/listinfo/zope-cmf See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests
Re: [Zope-CMF] Accessing PageMacros
Heya Charlie, The way I do this is register a view for * with the name I'm using for the macro: Then in in the template: Not sure if that's the SOP or what...but works for me. Cheers, Andrew On 3/11/10 7:12 AM, "Charlie Clark" wrote: > Hi, I think I'm probably making this more complicated than it need be but I'm > stumped. I have a form that uses five.formlib.formbase.PageForm, ie. the > default zope.formlib PageForm. How can I make use of the macros in the > template, ie. what is the lookup for the macros? @@form_macros only seems to > have widget_macros and addform and I'd like the whole page and just make use > of the slots. ... Zope 3 skin declarations > aren't my strong suit and I think they just wrap the meta-class stuff which > has my head spinning. Charlie -- Charlie Clark Helmholtzstr. > 20 Düsseldorf D- 40215 Tel: +49-211-938-5360 GSM: > +49-178-782-6226 ___ Zope-CMF > maillist - > Zope-CMF@zope.org https://mail.zope.org/mailman/listinfo/zope-cmf See > https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests ___ Zope-CMF maillist - Zope-CMF@zope.org https://mail.zope.org/mailman/listinfo/zope-cmf See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests
[Zope-CMF] Accessing PageMacros
Hi, I think I'm probably making this more complicated than it need be but I'm stumped. I have a form that uses five.formlib.formbase.PageForm, ie. the default zope.formlib PageForm. How can I make use of the macros in the template, ie. what is the lookup for the macros? @@form_macros only seems to have widget_macros and addform and I'd like the whole page and just make use of the slots. ... Zope 3 skin declarations aren't my strong suit and I think they just wrap the meta-class stuff which has my head spinning. Charlie -- Charlie Clark Helmholtzstr. 20 Düsseldorf D- 40215 Tel: +49-211-938-5360 GSM: +49-178-782-6226 ___ Zope-CMF maillist - Zope-CMF@zope.org https://mail.zope.org/mailman/listinfo/zope-cmf See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests