Sébastien VINOT wrote:
Philipp von Weitershausen a écrit :
Sébastien VINOT wrote:
Is it possible to associate a class with a skin template ?

Sure, but it won't help.

Sorry but why will it not help me ?

Because the 'view' variable will be bound to the view class of the template *using* the macro, not *defining* the macro.

I tried to "customize" an example (from chap 24 "Zope3") but
unfortunately even if my zcml is read with no errors, the final view
used is the one associated with my component.

Right, because when a ZPT uses a skin macro, the raw macro "byte code" is inserted into the the ZPT. That means all TALES variables are bound to the actual view, not the skin.

Okay, but (stop me if I'm wrong) a template can be associated to a class.

Yes, but again: when you use a macro, the macro "byte code" gets executed in the context of the template *using* the macro.

I took your example 8.2.4 (chapter 8.2 Page Template macros) and thought the view class was "StandardMacros".

standardmacros is something different. It's a special view that lets us look up macros conveniently. Read that section again, it seems you've not understood standardmacros yet.

Is there a way to do this ?

Define a view class for * that you will query from the macro, e.g. context/@@myhelperview/foo.


I added (just for test) a function foo into your StandardMacros and added into my skin template :
<metal:macro use-macro="context/@@StandardMacros/foo" />

And I get : TypeError: unsubscriptable object

Please don't quote single exceptions. They're almost meaningless without a traceback.

I also told you to define your own helper view. I never said anything about standardmacros.


Zope3-users mailing list

Reply via email to