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

Florent Guillaume fg@nuxeo.com
Thu, 20 Mar 2003 19:52:01 +0100


In article <b595sv+one6@eGroups.com> you write:
> 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
> 5. imported MyPortalFolder.py in MY __init__.py
> 6. Restarted Zope
> 
> No improvement. But if I change the PortalFolder.py in CMFCore 
> directory, it works!
> 
> Why cant I make it happen thru the "magic" of Monkey Patching? 
> 
> So I can easily upgrade in future.
> I got the idea from a HOW-TO in "Caseman"'s home page.

PortalFolder is not indexed so will not be searchable.
Use a SkinnedFolder.
BTW it seems you're a bit confused about the concepts of inheritance.
Why do you want to set things on the original PortalFolder class ?
Do it in your derived class.

Florent

-- 
Florent Guillaume, Nuxeo (Paris, France)
+33 1 40 33 79 87  http://nuxeo.com  mailto:fg@nuxeo.com