首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在安装准产品时选择配置文件(Plone 4)

在安装准产品时选择配置文件(Plone 4)
EN

Stack Overflow用户
提问于 2014-04-14 09:20:23
回答 3查看 159关注 0票数 2

在Plone 4应用程序中动态加载MathJax时,我遇到了性能问题。因此,我在https://github.com/collective/collective.mathjax中找到了Plone集成,并且,正如我注意到的那样,它分叉工作,运行良好;我包含了当前的MathJax 2.3,并将配置文件更改为使用“本地”副本。

现在,我想知道是否可以在"online"/"remote“行为(从rackcdn.com加载所有内容)和”默认“行为(使用包含的副本)之间进行选择,方法是在Plone QuickInstaller工具中安装产品时选择配置文件。

我像这样改变了configure.zcml

代码语言:javascript
复制
<configure
    xmlns="http://namespaces.zope.org/zope"
    xmlns:browser="http://namespaces.zope.org/browser"
    xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
    i18n_domain="collective.mathjax">

  <browser:resourceDirectory
      name="mathjax"
      directory="resources/MathJax" />

  <genericsetup:registerProfile
      name="default"
      title="collective.mathjax: default"
      directory="profiles/default"
      description="collective.mathjax default profile: Includes MathJax 2.3."
      provides="Products.GenericSetup.interfaces.EXTENSION" />

  <genericsetup:registerProfile
      name="online"
      title="collective.mathjax: online"
      directory="profiles/online"
      description="collective.mathjax online profile: Load MathJax dynamically from rackcdn.com."
      provides="Products.GenericSetup.interfaces.EXTENSION" />

</configure>

不幸的是,我无法在QuickInstaller中看到“在线”配置文件,甚至在卸载产品和更改版本号之后也看不到。

更新:在控制台输出中,我找到了以下文本:

INFO CMFQuickInstallerTool产品collective.mathjax的多个扩展配置文件。二手配置文件:collective.mathjax:default

是否有一些根本性的误解,或者我能做些什么让人们选择?

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2014-04-22 15:35:13

从Ida和Keul的有益评论中可以得到一个答案:

  • --(不幸的是)--在替代配置文件(这使得“概要文件”这个名字在这里有点误导)之间没有选择。
  • 为了在配置文件之间切换,我以拥有不同的分支而告终。这个过程如下:
    • 转到产品目录并切换到所需的分支,例如git checkout <branch name>
    • 重新启动Plone (否则它不会注意到更改,除非同时有一个新的版本号)
    • 重新安装产品;
    • 当一切顺利时,更新buildout.cfg以反映更改。

票数 0
EN

Stack Overflow用户

发布于 2014-04-14 11:28:29

profile ( ZMI和Plone )将只显示一个配置文件作为“安装”配置文件。被选中的人将是第一个被发现的(按字母顺序)。

要手动运行配置文件,请转到ZMI中的portal_setup工具,然后转到“导入”选项卡并选择您想要的配置文件(这里提供的订单一团糟).你可能会找到一个很长的组合盒)。在页面末尾选择“导入所有步骤”

票数 3
EN

Stack Overflow用户

发布于 2015-02-05 11:16:44

实际上,可以在Quickinstaller中显示多个“替代”配置文件--您只需通过为自己的(子)包注册每个配置文件就可以‘欺骗’GenericSetup。

因此,诀窍是将配置文件定义放在驻留在不同包(目录)中的不同configure.zcml文件中,并确保在每个configure.zcml文件中包含<five:registerPackage package="."/>指令。

虽然它有效,但我不知道这个技巧有多值得推荐:我在dexterity.membrane包中找到了它,在这里用作示例:

首先,“默认”配置文件完全正常地在configure.zcml包的主dexterity.membrane中注册。没有什么特别的-,但请注意,它包括子包

代码语言:javascript
复制
<configure
    xmlns="http://namespaces.zope.org/zope"
    xmlns:five="http://namespaces.zope.org/five"
    xmlns:i18n="http://namespaces.zope.org/i18n"
    xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
    i18n_domain="dexterity.membrane">

  <!-- Include configuration for dependencies listed in setup.py -->
  <includeDependencies package="." />
  <!-- Grok the package to initialise schema interfaces and content classes -->

  <i18n:registerTranslations directory="locales" />

  <include package=".behavior" />
  <include package=".content" />

  <!-- Register an extension profile to make the product installable -->
  <genericsetup:registerProfile
      name="default"
      title="dexterity.membrane: behaviors"
      description="Configuration for the dexterity.membrane behaviors"
      directory="profiles/default"
      provides="Products.GenericSetup.interfaces.EXTENSION"
      />
  <!-- Note that the example profile is registered in the content
       directory.  It is registered in such a way that both profiles
       are visible and can be installed separately.  Any upgrade steps
       for that profile are also defined there. -->

  <genericsetup:upgradeStep
      title="Update profile"
      description="Dummy step to fix profile registration after rename."
      source="1000"
      destination="1001"
      handler="dexterity.membrane.migration.dummy_step"
      profile="dexterity.membrane:default" />

  <adapter name="Title" factory=".indexers.Title" />

  <!-- -*- extra stuff goes here -*- -->

</configure>

这里是上述registerPackageconfigure.zcml:也没有什么特别的,除了(第二个)指令和第二个profile

代码语言:javascript
复制
<configure
    xmlns="http://namespaces.zope.org/zope"
    xmlns:five="http://namespaces.zope.org/five"
    xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
    i18n_domain="dexterity.membrane">

  <!-- make this show up in the quickinstaller separately -->
  <five:registerPackage package="."/>

  <genericsetup:registerProfile
      name="example"
      title="dexterity.membrane: content"
      description="Configuration for the dexterity.membrane example content type"
      directory="../profiles/example"
      provides="Products.GenericSetup.interfaces.EXTENSION"
      />

</configure>
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/23056387

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档