2
我正在將一些舊產品更新到4.x代碼庫。Plone 3.3 - > 4 migration:setup_tool.setImportContext()missing
這在舊Install.py共同的模式:
def install(self):
out=StringIO()
# Install CSS, JS and other GenericProfile stuff
setup_tool = getToolByName(self, 'portal_setup')
original_context = setup_tool.getImportContextID()
setup_tool.setImportContext('profile-Products.NoneMultiSelectionWidget:default')
setup_tool.runAllImportSteps()
然而,setup_tool.setImportContext()方法不再存在。什麼是正確的替換代碼?我需要替換代碼還是自動拾取GenericSetup XML文件?
回溯:
- __traceback_info__: ('Products.NoneMultiSelectionWidget',)
File "/Users/moo/code/buildout-cache/eggs/Products.ExternalMethod-2.13.0-py2.6.egg/Products/ExternalMethod/ExternalMethod.py", line 234, in __call__
return f(*args, **kw)
- __traceback_info__: ((<PloneSite at /plone>,), {}, None)
File "/Users/moo/code/x/src/x/Products.NoneMultiSelectionWidget/Products/NoneMultiSelectionWidget/Extensions/Install.py", line 19, in install
setup_tool.setImportContext('profile-Products.NoneMultiSelectionWidget:default')
AttributeError: setImportContext
謝謝。奇蹟般有效。 – 2012-04-24 06:23:20