Override a module in plone's eggs?
I want to override a method (assignment_mapping_from_key
) in:
eggs/plone.app.portlets-1.1.5.1-py2.4.egg/plone/app/portlets/utils.py
...because when I set a portlet in portlets.xml
开发者_如何学JAVA, I have to use a full path in key
attribute and I don't have it (production and development servers have different urls), I want to use a relative one. I would like to "override" this module inside my own personal module.
Is this possible? I can't upgrade this egg and don't have access to the egg on server.
I can't say I would recommend it, but you can have a look at:
- http://pypi.python.org/pypi/collective.monkeypatcher/1.0.1
which may help you do what you want to do, even if it is a bad idea.
In general, Plone is designed to be customized inside your own personal module, but not necessarily in the way you describe (think custom content types, themes, etc.)
Also, you may want to describe what you are trying to do in general (big picture) vs. asking how to override assignment_mapping_from_key.
You can't override a method, but why would you not just write your own? You can use a custom import handler (what's sometimes called an "import_various handler") to call such a method in Python code.
I think the key ought to be relative to the Plone site root, mind, so maybe what you've discovered is a bug/misfeature in Plone.
精彩评论