簡體   English   中英

猴子補丁添加缺少的界面

[英]Monkey patch to add a missing interface

Collective.monkeypatcher如何用於在某IFooBar中添加someproduct

這是我嘗試過的方法,它是錯誤的(因為IFooBar在原始產品中不存在。)

<monkey:patch description="Create missing FooBar interface"
              class="someproduct.interfaces.IFooBar"
              original="IFooBar"
              replacement="myproduct.patches.IFooBar"
              docstringWarning="true" />

錯誤為ConfigurationError: ('Invalid value for', 'class', 'ImportError: Module someproduct.interfaces has no global IFooBar')

我的最終目標是跳過此錯誤: PicklingError: Can't pickle <class 'someproduct.interfaces.IFooBar'>: attribute lookup someproduct.interfaces.IFooBar failed在嘗試激活/停用加載項時PicklingError: Can't pickle <class 'someproduct.interfaces.IFooBar'>: attribute lookup someproduct.interfaces.IFooBar failed

這是因為我安裝了具有IFooBarsomeproduct的新版本,然后我恢復了較舊的版本(沒有IFooBar ),而沒有卸載該附件。

更新:

替換行:

class="someproduct.interfaces.IFooBar"

class="someproduct.interfaces"

這是同一件事。 錯誤: ConfigurationError: Original IFooBar in <module 'someproduct.interfaces' from '/plone/buildout-cache/eggs/someproduct-1.2-py2.7.egg/some/path/interfaces.pyc'> not found

哦。 只需添加: ignoreOriginal="true"

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM