Matt Hahnfeld wrote:
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

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?

Other modules may have already imported it, using:

  from Products.CMFCore.utils import _checkPermission

Those modules *also* need monkey patching, because they are holding onto a reference to the original object, even though you have bound a new reference to that name with your monkey.

Tres Seaver          +1 202-558-7113          [EMAIL PROTECTED]
Palladion Software   "Excellence by Design"

Zope-CMF maillist  -

See for bug reports and feature requests

Reply via email to