覆盖克隆人蛋中的模块?
我想重写以下方法 (assignment_mapping_from_key
):
eggs/plone.app.portlets-1.1.5.1-py2.4.egg/plone/app/portlets/utils.py
...因为当我在 portlets.xml
中设置 portlet 时,我必须在 中使用完整路径key
属性,但我没有它(生产和开发服务器有不同的 url),我想使用一个相对的属性。我想在我自己的个人模块中“覆盖”这个模块。
这可能吗?我无法升级此鸡蛋,也无法访问服务器上的鸡蛋。
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
, 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不能说我会推荐它,但你可以看看:
这可以帮助你做你想做的事,即使这是一个坏主意。
一般来说,Plone 被设计为在您自己的个人模块内进行定制,但不一定按照您描述的方式进行定制(考虑定制内容类型、主题等)。
此外,您可能想要描述您一般想要做的事情(大图)与询问如何覆盖 assignment_mapping_from_key。
I can't say I would recommend it, but you can have a look at:
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.
您无法重写方法,但为什么不编写自己的方法呢?您可以使用自定义导入处理程序(有时称为“import_various 处理程序”)在 Python 代码中调用此类方法。
请注意,我认为密钥应该与 Plone 站点根相关,所以也许您发现的是 Plone 中的错误/错误功能。
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.