[Zope-CMF] Re: Monkey patching doesn't seem to work
Yuppie
schubbe@web.de
Wed, 19 Mar 2003 09:36:36 +0100
Hi!
suresh_vv wrote:
> I want to make PortalFolders searchable.
>
> So:
>
> 1. I created my version of MyPortalFolder.py in MY products directory,
> 2. imported the CMFCore version of PortalFolder
> 3. wrote a function mySearchableText
> 4. Set PortalFolder.SearchbleText = mySearchableText
^^
Is this typo also in your code? Please attach your code for questions
like this.
> 5. imported MyPortalFolder.py in MY __init__.py
> 6. Restarted Zope
I use this code inside the __init__.py:
<code>
from AccessControl import ClassSecurityInfo
from Globals import InitializeClass
from Products.CMFCore.CMFCorePermissions import myPermission
from Products.CMFCore.PortalFolder import PortalFolder
PortalFolder.security = ClassSecurityInfo()
def myMethod(self):
pass
PortalFolder.security.declareProtected(myPermission, 'myMethod')
PortalFolder.myMethod = myMethod
InitializeClass(PortalFolder)
</code>
And as Raphael already mentioned: Make sure you have a working reindex
method.
HTH,
Yuppie