Search code examples
plonemathjaxplone-4.x

Choose a profile when installing a quickinstaller product (Plone 4)


I had performance problems when loading MathJax dynamically in my Plone 4 application. Thus, I found the Plone integration at https://github.com/collective/collective.mathjax and, as I noticed it does the same, forked it, which works well; I included a current MathJax 2.3 and changed the profile to use the "local" copy.

Now I wonder whether it is possible to choose between "online"/"remote" behaviour (load everything from rackcdn.com) and the "default" behaviour (use the included copy) by choosing a profile when installing the product in the Plone QuickInstaller Tool.

I changed the configure.zcml like this:

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

Unfortunately I can't see the "online" profile in the QuickInstaller, not even after deinstalling the product and changing the version number.

Update: In the console output, I found the following text:

INFO CMFQuickInstallerTool Multiple extension profiles found for product collective.mathjax. Used profile: collective.mathjax:default

Is there some fundamental misunderstanding, or what can I do to let people choose?


Solution

  • To make an answer from the helpful comments of Ida and Keul:

    • There is (unfortunately) no such thing as a choice between alternative profiles (which makes the name "profiles" slightly misleading here, IMO).
    • To switch between profiles, I ended in having distinct branches. The process goes like this:
      • Go to the product directory and switch to the desired branch, e.g. git checkout <branch name>
      • Restart Plone (otherwise it wouldn't notice the change, unless there was a new version number meanwhile)
      • re-install the product;
      • when all is well, update the buildout.cfg to reflect the change.