2014-04-14 42 views
2

我的Plone 4應用程序中動態加載MathJax時出現性能問題。因此,我發現Plone整合在https://github.com/collective/collective.mathjax,正如我注意到它一樣,分叉它,這運作良好;我包含了當前的MathJax 2.3,並更改了配置文件以使用「本地」副本。安裝快速安裝產品(Plone 4)時選擇一個配置文件

現在我想知道是否可以通過在安裝產品時選擇配置文件來選擇「在線」/「遠程」行爲(從rackcdn.com加載所有內容)和「默認」行爲(使用附帶的副本) Plone QuickInstaller工具。甚至沒有在卸載該產品,並改變了版本號之後

<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,:

我改變了configure.zcml這樣。

更新:在控制檯輸出,我發現了以下文字:

信息CMFQuickInstallerTool發現產品collective.mathjax多的擴展選項。使用配置文件:collective.mathjax:default

是否存在一些根本的誤解,或者我可以做什麼讓人們選擇?

+0

測試你的[fork](https://github.com/tobiasherp/collective.mathjax),這兩個配置文件都顯示出來並且可以安裝而不會出錯。無法重現您的問題。 –

+1

附加信息:當創建一個新的Plonesite時,我指的是表單中的產品列表。在那裏,兩個配置文件顯示。在網站創建後安裝產品,請參閱keul的答案。 –

+0

如果我理解正確,選擇的配置文件適用於全新站點對象的特殊情況,但不適用於將產品添加到現有站點的情況。這對我來說看起來不太一致......但它看起來確實如此。 – Tobias

回答

0

從Ida和Keul的有益的意見作出答覆:

  • (不幸)沒有這樣的事,作爲一個在替代配置文件(這使得「配置文件」在這裏略有誤導,IMO)之間做出選擇。
  • 要在配置文件之間切換,我結束了不同的分支。過程如下:
    • 轉到產品目錄並切換到所需的分支,例如, git checkout <branch name>
    • 重新啓動Plone(否則它不會注意到更改,除非有新版本號)
    • 重新安裝產品;
    • 當一切正常時,更新buildout.cfg以反映更改。
3

Plone Quickinstaller(包括ZMI和Plone UI)只會將一個配置文件顯示爲「安裝」配置文件。選定的將是第一個找到的(按字母順序)。

要手動運行配置文件,轉到ZMI的portal_setup工具,然後去了「導入」選項卡,選擇您想要的配置文件(這裏所提供的順序是一個爛攤子......你可能會發現一個很長組合框)。在頁面的最後選擇「進口的所有步驟

+0

好的,我試過了。之後,我定義了兩個配置文件...因此,我的結論是:Plone Quickinstaller不打算提供備選配置文件的選擇;當我手動運行一個,另一個不會被刪除。因此,我需要找到另一種方式。 – Tobias

+1

對不起,我部分誤解了你的問題:不,他們不是「替代」配置文件。配置文件是一組配置操作,將被執行並「執行」。這是你的職責(在這種情況下:第三方產品)提供清理垃圾的卸載配置文件。 您可以手動創建您的卸載配置文件(將其添加到產品的代碼中)。我編寫了一本關於如何卸載Plone產品的指南:http://blog.keul.it/2013/05/how-to-make-your-plone-add-on-products.html –

+0

答案在您的評論中:沒有*備選*配置文件(這使得配置文件對野獸來說有點誤導性的名稱,IMO)。如果你讓這個答案,我會接受它。 – Tobias

1

它實際上是可以有多個「另類」的配置文件顯示在Quickinstaller - 你只需要「絕招」 GenericSetup通過註冊爲自己的(分)包中的每個配置文件。

因此,關鍵是要放到裏面駐留在不同的包(目錄),並確保包括每個configure.zcml文件<five:registerPackage package="."/>指令不同configure.zcml文件中的配置文件定義。

雖然它的作品,我不知道這招怎麼推薦的是:我發現它在dexterity.membrane包,使用如下的例子:

首先,「默認」配置文件在主完全正常註冊的dexterity.membrane包。沒有什麼特別的 - 但要注意,它包括content分裝

<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> 

這裏的說的了configure.zcmlcontent subpackage:沒什麼特別的要麼,除了(第二)registerPackage指令,和第二輪廓

<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>