Closed seanupton closed 7 years ago
@keul is this related with the problem you described some months ago? I can't remember.
I just saw @seanupton comment on #1749
@hvelarde @keul I suspect that these are distinct, unless there is some kind of subprocess thing happening in the TTW build of resources (I do not understand that process well enough), but this issue and its fix in PR is for cases where there is no real HTTPRequest, like in the case of the build scripts.
_generate_gruntfile.py
usesTraversable.unrestrictedTraverse()
to introspect resources provided by browser resources and/or resource directories. This fails for any resourceDirectory where plone.browserlayer layer specification is used, which pits core resource compilation process against a stated best-practice for add-on developers. This is even the case when the bundle being compiled is completely unrelated to the add-on in question.This should never happen. This failure can be fixed by having the script load all declared layers.
Reproducing:
In Products.CMFPlone master (~5.1b4.dev0), add any add-on with:
Desired outcome:
Successful build, no errors.
What actually happened:
TraversalError attempting to traverse to the namespace/name in question, because lookup using acquired request fails when layers are not marked on the request.
What version of Plone/ Addons I am using:
Products.CMFPlone master (~5.1b4.dev0).
Fixing:
Layers should be loaded by script; there is an available request object to mark. This is trivially implemented by getting registrations from the site's components, and marking the request with all interfaces.