Пример #1
0
    def getApplication(self, request):
        """Returns the object where traversal should commence.
        """
        # Look for a defined 'snap.skin' variable defined in the
        # request environment by the 'config' wsgi-filter and if
        # found, switch the skin to that.
        skin = request.get('snap.skin')
        if skin is not None:
            stack = request.getTraversalStack()
            # Check if a skin is not already setup.
            if not filter(None, ['++skin++' in part for part in stack]):
                skin = component.queryUtility(ISkin, skin, default=None)
                if skin is not None:
                    applySkin(request, skin)

        proxies = request.get('snap.security.proxies', None)
        if proxies in ('off', 'disable', 'false'):
            return app
        return ProxyFactory(app)
Пример #2
0
 def __init__(self, context, request):
     # Make sure we enter APIDOC territory.
     applySkin(request, APIDOC)
     super(ApidocEditPreferenceGroup, self).__init__(context, request)
Пример #3
0
 def __init__(self, ob, request=None):
     if request:
         from zope.app.apidoc.browser.skin import APIDOC
         applySkin(request, APIDOC)
     self.context = ob
Пример #4
0
 def traverse(self, name, ignored):
     self.request.shiftNameToApplication()
     skin = zope.component.getUtility(ISkin, name)
     applySkin(self.request, skin)
     return self.context