I've been "all over the place" for a solution howto use METAL macros from PythonScript but I can find any. Is there anyone that can help me out? (or do I just have to fall back on old fasion DTML Methods)? -- Johan Carlsson Tel: + 46 8 31 24 94 Colliberty Mob: + 46 70 558 25 24 Torsgatan 72 Email: johanc@easypublisher.com SE-113 37 STOCKHOLM Skype: colliberty
On Sun, Jan 25, 2004 at 12:25:33AM +0100, Johan Carlsson wrote:
I've been "all over the place" for a solution howto use METAL macros from PythonScript but I can find any.
Is there anyone that can help me out? (or do I just have to fall back on old fasion DTML Methods)?
Maybe you should explain more what you are trying to do. You can get access to a macro easily enough: mymacro = context.name_of_template.macros[name_of_macro] ... but what do you want to *do* with it? -- Paul Winkler http://www.slinkp.com Look! Up in the sky! It's FIVE DOLLAR FISH! (random hero from isometric.spaceninja.com)
I want to Use it (as in metal:use-macro). It probably means that I want to call it like a method (but I don't know how it's suppost to work yet), and I definitely want to send arguments to it when calling it. Why I want this is because I want to construct a generic template for rendering "menus" that takes one argument "menu_name". I then want to use this generic template from a PythonScript that seeks up all existing menus in the current context and renders them. (Eg. loop over objectValue(spec='MenuClass')) I don't want to build this in TAL because I regard this as pure logic, so I would prefer having it in a PythonScript. Like this: <div metal:define-macro="render_all_list_in_context"> <div tal:repeat="listname python:here.objectIds(spec='EasyNamedMenu')"> <div metal:use-macro="here/macro_listings.pt/macros/generic_named_list"/> </div> </div> -- Johan Carlsson Tel: + 46 8 31 24 94 Colliberty Mob: + 46 70 558 25 24 Torsgatan 72 Email: johanc@easypublisher.com SE-113 37 STOCKHOLM Skype: colliberty
Johan Carlsson wrote at 2004-1-25 00:25 +0100:
I've been "all over the place" for a solution howto use METAL macros from PythonScript but I can find any.
Call a PageTemplate from your Python Script that in turn uses the macro you want. Direct macro rendering may be possible but is not an anticipated use case ;-) -- Dieter
Dieter Maurer wrote:
Johan Carlsson wrote at 2004-1-25 00:25 +0100:
I've been "all over the place" for a solution howto use METAL macros
from PythonScript but I can find any.
Call a PageTemplate from your Python Script that in turn uses the macro you want.
That might do the trick, but it really pokes my eye with inefficiensy :-)
Direct macro rendering may be possible but is not an anticipated use case ;-)
*lol* No, I'm a pretty weird guys that comes up with this strange use cases all the time ;-) But I think ZPT would make a splended "macros library" :-) -- Johan Carlsson Tel: + 46 8 31 24 94 Colliberty Mob: + 46 70 558 25 24 Torsgatan 72 Email: johanc@easypublisher.com SE-113 37 STOCKHOLM Skype: colliberty
participants (3)
-
Dieter Maurer -
Johan Carlsson -
Paul Winkler