Plone技术资料

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 2237|回复: 0

在Plone5.1升级到Plone5.2过程中可能的坑

[复制链接]
发表于 2019-7-30 20:57:08 | 显示全部楼层 |阅读模式
本文收集了在Plone5.1升级到Plone5.2过程中可能遇到的一系列坑以及解决办法.
1、不能导入IPossibleSite错误
错误产生的条件:
当你有定制的Dextertity内容类型,并且,你的代码中启用five.grok来代替ZCML来书写配置信息。
产生原因:
five.grok 依存的 IPossibleSite接口由原来zope.location包迁移到了zope.component包

  1. 3.7.1 (2009-11-18)

  2.     Move the IPossibleSite and ISite interfaces to zope.component as they are dealing with zope.component’s concept of a site, but not with location.

复制代码


src/five/grok/components.py

  1. from zope.annotation.interfaces import IAttributeAnnotatable
  2. from zope.location.interfaces import IPossibleSite
  3. from zope import interface
复制代码
解决办法:
编辑src/five/grok/components.py
将这行代码
  1. from zope.location.interfaces import IPossibleSite
复制代码
更改为:
  1. from zope.component.interfaces import IPossibleSite
复制代码


2、配置冲突错误
在Zope-4.1.1和zope.browserresource两个包中同时定义了 FileETag adapter,导致zcml配置冲突。
解决办法:取消Zope-4.1.1中重复加载的适配器定义。
编辑配置文件:
  1. vi /home/demo/.buildout/eggs/Zope-4.1.1-py2.7.egg/Products/Five/browser/configure.zcml
复制代码

注释adapter定义,如下代码9~10行所示:

  1. <configure xmlns="http://namespaces.zope.org/zope"
  2.            xmlns:browser="http://namespaces.zope.org/browser">

  3.   <interface
  4.       interface="zope.browsermenu.interfaces.IMenuItemType"
  5.       />

  6.   <include package="OFS" file="absoluteurl.zcml"/>
  7. <!-- adam
  8.   <adapter factory="zope.browserresource.file.FileETag" /> -->

  9.   <browser:view
  10.       for="OFS.interfaces.IObjectManager"
  11.       name="+"
  12.       class=".adding.ContentAdding"
  13.       permission="zope2.ViewManagementScreens"
  14.       >

  15.     <browser:page name="index.html"  template="adding.pt" />

  16.   </browser:view>
复制代码


3、要求Product.archetype依存性错误
错误产生条件:
加载三方包dexterity.membrane时出现。
错误产生原因:
dexterity.membrane依存于Products.membrane,而Products.membrane目前最新版4.0依然依存于Product.archetype,但Plone5.2.0后已经完全drop掉
Product.archetype和Product.ATContenttype。
  1.   File "/home/plone/workspace/Plone5sites/sites/src/Products.membrane/Products/membrane/at/interfaces.py", line 11, in <module>
  2.     from Products.Archetypes.interfaces import IBaseObject
  3. ImportError: No module named Archetypes.interfaces
复制代码

生活还要继续,我们不能退回到原始社会···
解决办法:
新建Products.membrane 5.0分支,drop 掉对Product.archetype的依存,并适当更新代码,使其完全支持Plone5.2.x。

4、Plone.PlonePAS导入错误:
  1.   File "/home/plone/workspace/Plone5sites/sites/src/Products.membrane/Products/membrane/setuphandlers.py", line 5, in <module>
  2.     from Products.PlonePAS.Extensions.Install import activatePluginInterfaces
  3. zope.configuration.xmlconfig.ZopeXMLConfigurationError: File "/home/plone/workspace/Plone5sites/sites/src/Products.membrane/Products/membrane/exportimport/configure.zcml", line 17.2
  4.     File "/home/plone/workspace/Plone5sites/sites/parts/instance/etc/site.zcml", line 16.2-16.23
  5.     File "/home/plone/.buildout/eggs/Products.CMFPlone-5.2.0-py2.7.egg/Products/CMFPlone/configure.zcml", line 110.2-114.8
  6.     File "/home/plone/workspace/Plone5sites/sites/src/dexterity.membrane/dexterity/membrane/configure.zcml", line 9.2-9.37
  7.     File "/home/plone/workspace/Plone5sites/sites/src/Products.membrane/Products/membrane/configure.zcml", line 12.2-12.37
  8.     ImportError: No module named Extensions.Install
复制代码

错误原因:
  1. 5.0.1 (2015-03-21)

  2.     Add a integrated test setup with codeanalysis and travis. For this moved Products folder to a src folder in order to follow the package structure expected by buildout.plonetest’s qa.cfg. [jensens]
  3.     Make patching of LDAPMultiPlugin explizit. Code using those must call Products.PlonePAS.ldapmp.patch_ldapmp with no parameters in order to activate the patches. [jensens]
  4.     Removed (optional) Archetypes Storage (used in past with CMFMember, which itself was long time ago superseeded by Membrane). Probably dead code. If theres someone out there needing it in Plone 5 please copy the code from git/Plone4 in your addon/project. [jensens]
  5.     Moved Extensions/Install.py functions to setuphandlers, kept BBB import for activatePluginInterfaces since this is imported by borg.localrole. [jensens]
复制代码
错误处理:
使用 Products.membrane 5.0 branch



回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|Archiver|手机版|Plone技术资料 ( 湘ICP备14006519号-1 )

GMT+8, 2019-11-17 06:12 , Processed in 0.044562 second(s), 14 queries , Gzip On.

Powered by Plone! X3.4

© 2001-2019 Plone.org.

快速回复 返回顶部 返回列表