[z3-checkins] Re: r10172 - z3/Five/branch/regebro-standard_macros
Lennart Regebro
regebro at nuxeo.com
Thu Mar 31 11:18:01 MEST 2005
Philipp von Weitershausen wrote:
> regebro at codespeak.net wrote:
>
>> Modified: z3/Five/branch/regebro-standard_macros/CHANGES.txt
>> ==============================================================================
>>
>> --- z3/Five/branch/regebro-standard_macros/CHANGES.txt (original)
>> +++ z3/Five/branch/regebro-standard_macros/CHANGES.txt Wed Mar 30
>> 15:03:22 2005
>> @@ -1,5 +1,9 @@
>> Five Changes
>> ============
>> +* We now monkeypatch Zope3! The Five StandardMacros is put into place
>> + of the Zope3 standard macros. This is to enable access to
>> + context/@@form_macros which are otehrwise unavailable.
>> +
>
>
> [snip]
>
>> Modified: z3/Five/branch/regebro-standard_macros/monkey.py
>> ==============================================================================
>>
>> --- z3/Five/branch/regebro-standard_macros/monkey.py (original)
>> +++ z3/Five/branch/regebro-standard_macros/monkey.py Wed Mar 30
>> 15:03:22 2005
>> @@ -28,3 +28,9 @@
>>
>> HTTPRequest.getPresentationSkin = getPresentationSkin
>> HTTPRequest.setPresentationSkin = setPresentationSkin
>> +
>> + # Yes, we monkeypatch Zope3 as well. Nothing escapes our monkeys!
>> + from zope.app.basicskin import standardmacros
>> + from browser import StandardMacros
>> + standardmacros.StandardMacros = StandardMacros
>> +
>
>
> In your checkin and code comments, you have described what you're doing,
> but I still have no clue WHY you're doing this and why you think it's
> necessary to use a monkey... Maybe you can enlighten me...
Many common macros in Zope3 are accessed through
context/@@StandardMacros/xxx. But, the StandardMacros object is a
new-style class. To be able to load Zope3 products that have views based
on new-style classes, Five simply ignores any views that are. They are
silently ignored.
This means that all the macros that are ment to be accessed through a
@@StandardMacros, can't be accessed that way. This basically means that
skins for Zope3 are completely incompatible with Five, which in turn
causes a lot of extra trouble and work both when porting products and
when using add and editforms.
Last week I reached a new level of Zen on this issue, and I realized
that it wasn't that hard to fix it. Monkey patching this is not strictly
necessary. We can do copy-pasting ov every usage of StandardMacros and
use our own StandardMacros instead. But that causes code duplication...
Due to several reasons, the other changes I did to Five last week will
be undone ASAP and this branch will contain all fixes for Zope3 ZPT
compatibility. I feel that this is an important issue to increase
compatibility between Five and Zope3, and that the changes should be minor.
--
Lennart Regebro, Nuxeo http://www.nuxeo.com/
CPS Content Management http://www.cps-project.org/
More information about the z3-checkins
mailing list