Back to index

plone3  3.1.7
layer.py
Go to the documentation of this file.
00001 from zope.interface import directlyProvidedBy, directlyProvides
00002 from zope.component import getAllUtilitiesRegisteredFor
00003 from plone.browserlayer.interfaces import ILocalBrowserLayerType
00004 
00005 def mark_layer(site, event):
00006     """Mark the request with all installed layers.
00007     """
00008     request = event.request
00009     layers = getAllUtilitiesRegisteredFor(ILocalBrowserLayerType)
00010     ifaces = list(layers) + list(directlyProvidedBy(request))
00011         
00012     # Since we allow multiple markers here, we can't use 
00013     # zope.publisher.browser.applySkin() since this filters out 
00014     # IBrowserSkinType interfaces, nor can we use alsoProvides(), since
00015     # this appends the interface (in which case we end up *after* the
00016     # default Plone/CMF skin)
00017 
00018     directlyProvides(request, *ifaces)
00019