Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(18)  |  Call(12)  |  Derive(0)  |  Import(6)
Add a layer interface on the request
    

        def provide_request_layer(request, layer):
    """ Add a layer interface on the request
    """
    layer = type(layer) == list and layer or [layer]
    ifaces = layer + list(directlyProvidedBy(request))

    # Since we allow multiple markers here, we can't use
    # zope.publisher.browser.applySkin() since this filters out
    # IBrowserSkinType interfaces, nor can we use alsoProvides(), since
    # this appends the interface (in which case we end up *after* the
    # default Plone/CMF skin)
    directlyProvides(request, *ifaces)
        


src/f/t/ftw.book-2.2.20/ftw/book/layer.py   ftw.book(Download)
from ZPublisher.BaseRequest import DefaultPublishTraverse
from ftw.book.interfaces import IBook, IWithinBookLayer
from zope.component import adapts
from zope.dottedname.resolve import resolve
from ftw.pdfgenerator.utils import provide_request_layer
        if layout_layer_name:
            layout_layer = resolve(layout_layer_name)
            provide_request_layer(request, layout_layer)
 
        provide_request_layer(request, IWithinBookLayer)

src/f/t/ftw.book-2.2.20/ftw/book/browser/export_pdf.py   ftw.book(Download)
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
from ftw.pdfgenerator.browser.views import ExportPDFView
from ftw.pdfgenerator.utils import provide_request_layer
from ftw.book.interfaces import IAddRemarkLayer
 
    def __call__(self):
 
        if self.request.get('embed_remarks', False):
            provide_request_layer(self.request, IAddRemarkLayer)
 

src/f/t/ftw.pdfgenerator-1.3.0/ftw/pdfgenerator/tests/test_utils.py   ftw.pdfgenerator(Download)
from ftw.testing import MockTestCase
from zope.interface import Interface
from ftw.pdfgenerator.utils import provide_request_layer
 
 
        class ITestLayer(Interface): pass
 
        provide_request_layer(request, ITestLayer)
 
        self.assertTrue(ITestLayer.providedBy(request))
        class ITestLayer2(Interface): pass
 
        provide_request_layer(request, [ITestLayer, ITestLayer2])
 
        self.assertTrue(ITestLayer.providedBy(request))
        class ITestLayer2(Interface): pass
 
        provide_request_layer(request, ITestLayer)
        provide_request_layer(request, ITestLayer2)
 

src/f/t/ftw.book-2.2.20/ftw/book/tests/base.py   ftw.book(Download)
from ftw.book.tests import export
from ftw.pdfgenerator.config import DefaultConfig
from ftw.pdfgenerator.utils import provide_request_layer
from plone.app.testing import applyProfile
from plone.browserlayer.layer import mark_layer
        request = self.layer['portal'].REQUEST
        mark_layer(None, Dummy(request=request))
        provide_request_layer(request, IWithinBookLayer)
        provide_request_layer(request, self.book_layout_layer)
 

src/f/t/ftw.book-2.2.20/ftw/book/testing.py   ftw.book(Download)
from ftw.builder.testing import functional_session_factory
from ftw.builder.testing import set_builder_session_factory
from ftw.pdfgenerator.utils import provide_request_layer
from ftw.testing.layer import ComponentRegistryLayer
from plone.app.testing import IntegrationTesting, FunctionalTesting
            request = portal.REQUEST
            mark_layer(None, Dummy(request=request))
            provide_request_layer(request, IWithinBookLayer)
            provide_request_layer(request, IDefaultBookLayoutSelectionLayer)
 

src/f/t/ftw.book-2.2.20/ftw/book/tests/builders.py   ftw.book(Download)
from ftw.builder import builder_registry
from ftw.builder.archetypes import ArchetypesBuilder
from ftw.pdfgenerator.utils import provide_request_layer
 
 
    def after_create(self, obj):
        if self.apply_layer:
            provide_request_layer(obj.REQUEST, self.apply_layer)
        super(BookBuilder, self).after_create(obj)