[Product-Developers] changing the order of browser layers

David Glick (Plone) david.glick at plone.org
Mon Nov 11 18:13:31 UTC 2013


On 11/11/13, 9:23 AM, Héctor Velarde wrote:
> is there a way of changing the order of browser layers order besides 
> doing it on the request?

It's determined by the interface resolution order of the interfaces 
provided by the request. (i.e. request.__provides__.__iro__)

The rules are something like this:
1. The later an interface is defined, the higher its precedence in the 
interface resolution order.
2. If interface A is a subclass of interface B, interface A has higher 
precedence.
3. The machinery in plone.browserlayer and plone.theme makes sure that 
browser layers installed as local utilities (the normal way) have 
precedence over the "default" Plone browser layers, and that the browser 
layer associated with the active skin has highest precedence of all.

The easiest way to control the order among several add-ons is to make 
the browser layer interface that should have highest precedence subclass 
the others.


More information about the Product-Developers mailing list