[z3-checkins] Re: r10172 - z3/Five/branch/regebro-standard_macros

Philipp von Weitershausen philipp at weitershausen.de
Thu Mar 31 13:45:14 MEST 2005


Lennart Regebro wrote:
> Philipp von Weitershausen wrote:
> 
>>> Because in Five you have to do: here/main_template/macros/master,
>>
>>
>> Since when? Why? No! Please not! Why can't we be compatible with the 
>> Zope 3 syntax and do context/@@standard_macros/page?
> 
> Because it doesn't exist. I made some changes on Five trunk that puts it 
> there so you can. Before that it didn't exist.

Not sure when it got there, but I see StandardMacros in Five.browser

> Still, /page is only *one* standard macro. The other ones still do not 
> exist. They are used by some widgets, for example the object widget, and 
> I assume they are laos used bu other templates that do stuff like that.

Well, the 'page' macro should be provided by one's custom skin. So, 
CMFonFive, for example, might want to provide this macro as a bridge 
between a CMF skin and a Five skin, so that you use in Five-style 
templates context/@@standard_macros/page and you get the CMF skin. Five 
should only provide a minimal 'page' macro, which it already does in 
five_template.pt.

Yes, there are few other macros which need to be mimicked, but that's a 
minor detail and not part of this discussion.

>>> where you in Z3 do context/@@standard_macros/main. Also, in Z3 macros 
>>> you can do context/@@standard_macros/somethingsomething or 
>>> context/form_macros/somethingsomething and in Five you can't, because 
>>> these doesn't exist, because they are skipped, because they use a 
>>> StandardMacros based on new-style classes.
>>
>> We used to be able to do context/@@standard_macros/some_macro, and I 
>> think we still can. I'm not sure where you draw that assumption from 
>> that we can't or shouldn't.
> 
> Because when I do it fails. That's not an assumption. :)

What's the error?

>>> Yes, but the Zope3 registering uses StandardMacros as a view. As I 
>>> understand it, if we want to use Fives StandardMacros we have to 
>>> re-register them. But since we don't know where they are located, we 
>>> have to first copy and paste these ZPTs into five, so we CAN 
>>> re-register them.
>>
>>
>> I see now where your false assumption is. We don't have to re-register 
>> the ZPTs that StandardMacros points to. StandardMacros keeps an 
>> ordered list of names of ZPT views. When you do
>>
>>   context/@@standard_macros/some_macro_name
>>
>> it goes through all of those views and tries to get the macro 
>> 'some_macro_name' from them and returns the first one it finds.
>>
>> So, the coupling between StandardMacros and the ZPTs is loose. All 
>> that StandardMacros has is a list of browser view names. Nothing more.
> 
> 
> Ah, but these view do not exist. Because, they have StandardMacros as a 
> view class

I haven't found one ZPT view in Zope 3 that uses StandardMacros as a 
view class... I have no clue what you're talking about.

> and StandardMacros is a new style class, and hence, these 
> views are silently ignored by Five.

I can hardly imagine that. If they are ignored by Five at all, it must 
be a different problem.

>> I'm 99.9% certain that we don't have to copy every damn template to 
>> Five. That's the least thing I want to do. And it's absolutely not 
>> necessary, because we have Five's browser:page that registers Zope 3's 
>> template just fine. THe only problem is Zope 3's StandardMacros which 
>> we have to reimplement and reregister. But now I'm repeating myself...
> 
> No, your solution unfortunately does not work (I tried it).
> 
> These views STILL use StandardMacros as a view

How? You mean by doing context/@@standard_macros? Well, in Five that 
would look up our Five-based StandardMacros view, wouldn't it...

> Unless we other copy these templates to five an re-register them, or 
> monkeypatch StandardMacros.

First of all, I wonder why you always suggest copying templates. Do the 
templates need to be adjusted to work with Five? I don't think so, 
Five's ZPT implementation and Z3's are compatible, right?

Then you suggest re-registering them. What's actually WRONG with the way 
they are registered now? Do their ZCML configuration directive have to 
be changed to work with Five? I don't think so. Five supports 
browser:page just fine.

So where is your actual problem? What error do you get?

All I see for now is that we have to implement and register our own 
StandardMacros view (which we already do, btw) and possibly FormMacros 
(not sure where that is used and how we deal with that now).

Philipp


More information about the z3-checkins mailing list