[Zope-CMF] monkey patching CMFCore.utils isn't working?!?

Matt Hahnfeld matth at everysoft.com
Fri Jun 2 13:44:04 EDT 2006


I am using Plone 2.1.2, w/ CMF 1.5.5.  I'm having trouble using
the overridden _checkPermission function in 1.5.5 to handle proxy roles on
a FSPythonScript.  After hacking around, I've determined the best method
to repair this issue is to "backport" CMF 1.6.0's function and make
_checkPermission call SecurityManager's _checkPermission.  I don't really
want to change the core libraries, so my idea was to do it as a monkey
patch.

So, I added this monkey patch to one of my custom zope products:

-----
from AccessControl import getSecurityManager

def _checkPermission(permission, obj):
    return getSecurityManager().checkPermission(permission, obj)

import Products.CMFCore.utils
Products.CMFCore.utils._checkPermission = _checkPermission
-----

But every time I use _checkPermission from Products.CMFCore.utils I'm
still getting the old one...  Is it possible to monkey patch functions (as
opposed to methods)?  Any idea why this monkey patch wouldn't be working?

Thanks!

Matt Hahnfeld
matth at everysoft.com




More information about the Zope-CMF mailing list