I want to have IThisPackageContentLayer before IOriginalLayer. How can I cange the layers order?
I have an upgrade step for importing browserlayer.xml (where I have only IThisPackageContentLayer). Can I make this layer to be prioritized against IOriginalLayer?
The code below shows an example how to change the iro (= "Interface Resolution Order"):
from zope.interface import Interface, alsoProvides
class I1(Interface): pass
class I2(Interface): pass
class C(object): pass
c=C()
alsoProvides(c, I1)
alsoProvides(c, I2)
print c.__provides__.__iro__
c.__provides__ = type(c.__provides__)(
c.__class__,
*((I2,) + tuple(i for i in c.__provides__.__iro__ if i is not I2))
)
print c.__provides__.__iro__
If you define IThisPackageContentLayer as a subclass of IOriginalLayer, it will be considered to have higher precedence and thus be listed earlier in the resolution order:
class IThisPackageContentLayer(IOriginalLayer):
# ...