[Zope-dev] zcml filtering

Wichert Akkerman wichert at wiggy.net
Tue Aug 5 11:36:30 EDT 2008


I have an interesting problem in the world of Zope 2 and zcml: CMFCore
registers an handleDynamicTypeCopiedEvent subscriber which does
something that I want to prevent at all costs, so I am trying to make
sure it is not subscriber. That appears to be impossible!

I can not unsubscribe it, since the subscriber directive dynamically
creates a subscriber factory and registers that, so I have nothing to
call unregisterSubscriptionAdapter with.

I can not use zc.configuration to prevent the CMFCore zcml from being
loaded since I have no control over if its zcml is loaded before mine,
and if CMFCore gets to go first the zc.configuration exlusion trick no
longer works. This trick also has a downside: you can only exclude whole
files, which in this case would mean I would have to re-register half a
dozen subscribers by hand and pray that a future CMFCore would not add
another one and I'ld miss that.

Normally if all else fails you can resort to a monkey patch. Even that
does not work here since the original method is wrapped in an adapter
factory and then registered with the site manager, and at that point
using a monkey patch to replace the original method is no longer useful.

I have to admit that I'm baffled.

Wichert.

-- 
Wichert Akkerman <wichert at wiggy.net>    It is simple to make things.
http://www.wiggy.net/                   It is hard to make things simple.


More information about the Zope-Dev mailing list