New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IDefaultBrowserLayer or a plain interface? #89
Comments
Yes. |
Then something is wrong with bobtemplates.plone or my setup... On https://github.com/collective/collective.contentalerts I have a browser layer deriving from |
Both errors are unrelated to IDefaultBrowserLayer. |
@gforcada Can this ticket be closed? |
I still don't see the point of using |
Maybe I wasn't too clear in my first comment about the reason. Zope has no way of knowing if your view for a layer with Interface as a base class is more specific than the view registered for IDefaultBrowserLayer. IOW you get undefined behavior. The order will probably depend on the alphabet, instead of class hierarchy. IMyProduct -> Interface IMyProduct -> IDefaultBrowserLayer -> Interface your product is more specific, you win always |
@do3cc So, views, which are not registered for any browser layer get implicitly registered for The plone.app.contenttypes browser layer derives from Side Note: When I want to extend another package, I let my package's browser layer inherit from the other one, so this is guaranteed to be more specific. |
Yes. Views that are not registered for any browser layer get implictly registered for If a package is always required for Plone, also for older versions of Plone, then it does not need to create its own browser layer. It could not set a layer in its declaration and all is fine. If one writes an add on, the add on should use a browser layer of its own, or at least prefix view names with something unique. Else, if two third party packages provide a view If Browser views always loose agains skin templates. It is kind of sad that this type of information is not available in any docs. Both need a rework to be spit into reference information and recipes with tips and tricks |
Ah something I forgot. the @@viewname exists only because the attribute access is preferred. |
@do3cc tnx for the detailed answer! i agree, this should be documented. |
@do3cc thanks for the explanations! I will update my add-ons according then 👍 |
As perfectly explained by @do3cc: plone/bobtemplates.plone#89 (comment)
Do we really need the
IDefaultBrowserLayer
fromzope.publisher
to create a package layer?The example shonw on plone.browserlayer shows that is just using a plain interface from
zope.interface
.../me wonders
The text was updated successfully, but these errors were encountered: