bobtemplates.plone
bobtemplates.plone copied to clipboard
Static directory does not work on Plone 4.3
I created a new bobtemplates.plone
package for Plone 4.3 and added a resource in the static directory and tried to access this. This failed, which led me to try all kinds of urls, because I can never remember how you spell it: ++plone++my.addon
, ++resource++my.addon
, ++static++my.addon
, ++my.addon++
or whatever. None of it worked.
Since pull request #159 (last year) we no longer use browser:resourceDirectory
, but plone:static
with type plone
. The plone
traversal namespace was introduced in Plone 5.0. So it does not actually work in Plone 4.3: ++plone++my.addon/some.js
is not found.
The code for the traverser in Plone 5.0 is in CMFPlone
.
Options:
- Switch back to
browser:resourceDirectory
. This works in all Plone versions, but then you cannot edit the resource TTW in the Plone 5 resource control panel. - Generate different code based on the targeted Plone version. If Plone 5 is targeted we assume the creator does not care about compatibility with Plone 4, and we can use
plone:resource
. - Backport the
plone
traverser to Plone 4.
The third option would need to be done in Products.CMFPlone
. The PloneBundlesTraverser
from 5.0 does too much, but we can create a really simple one similar to an earlier version of plone.app.theming. A quick test (adding the traverser to my addon) showed that this works.
The third option would take it out of the hands of bobtemplates.plone
. But since this package currently generates the wrong zcml for 4.3, I wanted to start the discussion here.
I vote for the 2 solution. Just assume browser:resourceDirectory
if Plone is 4 and plone:static
otherwise.
This bit me as well; currently I still need to create packages for Plone 4.3. As far as I'm concerned, the addon
template is currently broken for Plone 4.3.
This is a matter of compatibility, and for some happy people this might not be a need anymore, but for others it is. If an addon is needed to work in both worlds (the old and the new), browser:resourceDirectory
needs to be used even for Plone 5. Thus, it would be worth a question.
However, one might want to switch to the more recent plone:static
when the add-on evolves.
Therefore, I'd like to have the more modern variant in an XML comment, including a link to some explanation.