[Zope-CMF] Re: Monkey patching doesn't seem to work

Paul Winkler pw_lists@slinkp.com
Thu, 20 Mar 2003 11:03:38 -0500


On Thu, Mar 20, 2003 at 06:23:46AM -0000, suresh_vv wrote:
> Here is the code in my __init__.py
> 
> ------------------------------------------
> from Products.CMFCore import PortalFolder

You have imported the PortalFolder module....

> from Products.CMFCore.CMFCorePermissions import View
> 
> def mySearchableText(self):
>     "Returns a concatination of all searchable text"
>     # Should be overriden by portal objects
>     return "%s %s" % (self.Title(), self.Description())
> 
> PortalFolder.security = ClassSecurityInfo() 
> PortalFolder.security.declareProtected(View, 'SearchableText') 
> PortalFolder.SearchableText = mySearchableText

...and you have added a function to the PortalFolder module;
you haven't touched the methods of the PortalFolder class!

i think you need to change your import line:
from Products.CMFCore.PortalFolder import PortalFolder

-- 

Paul Winkler
http://www.slinkp.com
Look! Up in the sky! It's DISCO-SCHIZOID XENON WATERBOY!
(random hero from isometric.spaceninja.com)