configure,zcmlでregisterProfileをしていると、依存関係のチェックがうまく働かない。
configure.zcmlの中に次のように記述しておくと、プロダクトのプロファイルを登録してくれます。
<configure xmlns="http://namespaces.zope.org/zope" xmlns:genericsetup="http://namespaces.zope.org/genericsetup" i18n_domain="MyProduct" > <genericsetup:registerProfile name="default" title="MyProduct" directory="profiles/default" description="Extension profile for MyProduct" provides="Products.GenericSetup.interfaces.EXTENSION" /> </configure>
ところが、他のプロダクトのmetadada.xmlで、次のように、このプロファイルを参照すると、サイト設定のアドオンプロダクトのところに、mising-dependencyとエラーが表示されてしまいます。
<?xml version="1.0"?> <metadata> <version>0.0.1</version> <dependencies> <dependency>profile-MyProduct:default</dependency> </dependencies> </metadata>
同じ設定を、次のように__init__.pyの中で実行しておくと、こうはなりません。configure.zcmlの読込みタイミングの問題のようです。
from Products.CMFPlone.interfaces import IPloneSiteRoot from Products.GenericSetup import profile_registry from Products.GenericSetup import EXTENSION from config import SKINS_DIR, GLOBALS, PROJECTNAME def initialize(context): ・ ・ ・ profile_registry.registerProfile( 'default', PROJECTNAME, "Installs %s" % PROJECTNAME, 'profiles/default', PROJECTNAME, EXTENSION, for_=IPloneSiteRoot,) ・ ・ ・