Пример #1
0
    def __call__(self, environ, start_response):
        """See zope.app.wsgi.interfaces.IWSGIApplication"""
        request = self.requestFactory(environ['wsgi.input'], environ)

        # Let's support post-mortem debugging
        handle_errors = environ.get('wsgi.handleErrors', self.handleErrors)

        request = publish(request, handle_errors=handle_errors)
        response = request.response
        # Get logging info from principal for log use
        logging_info = ILoggingInfo(request.principal, None)
        if logging_info is None:
            message = b'-'
        else:
            message = logging_info.getLogMessage()

        if not PYTHON2:
            # In python 3, convert message bytes to native string
            message = message.decode('latin1')

        environ['wsgi.logging_info'] = message
        if 'REMOTE_USER' not in environ:
            environ['REMOTE_USER'] = message

        # Start the WSGI server response
        start_response(response.getStatusString(), response.getHeaders())

        # Return the result body iterable.
        return response.consumeBodyIter()
Пример #2
0
    def __call__(self, environ, start_response):
        """See zope.app.wsgi.interfaces.IWSGIApplication"""
        request = self.requestFactory(environ['wsgi.input'], environ)

        # Let's support post-mortem debugging
        handle_errors = environ.get('wsgi.handleErrors', self.handleErrors)

        request = publish(request, handle_errors=handle_errors)
        response = request.response
        # Get logging info from principal for log use
        logging_info = ILoggingInfo(request.principal, None)
        if logging_info is None:
            message = b'-'
        else:
            message = logging_info.getLogMessage()

        if not PYTHON2:
            # In python 3, convert message bytes to native string
            message = message.decode('latin1')

        environ['wsgi.logging_info'] = message
        if 'REMOTE_USER' not in environ:
            environ['REMOTE_USER'] = message

        # Start the WSGI server response
        start_response(response.getStatusString(), response.getHeaders())

        # Return the result body iterable.
        return response.consumeBodyIter()
Пример #3
0
 def setPrincipal(self, principal):
     'See IPublicationRequest'
     super(HTTPRequest, self).setPrincipal(principal)
     logging_info = ILoggingInfo(principal, None)
     if logging_info is None:
         message = '-'
     else:
         message = logging_info.getLogMessage()
     self.response.authUser = message
Пример #4
0
 def setPrincipal(self, principal):
     'See IPublicationRequest'
     super(HTTPRequest, self).setPrincipal(principal)
     logging_info = ILoggingInfo(principal, None)
     if logging_info is None:
         message = '-'
     else:
         message = logging_info.getLogMessage()
     self.response.authUser = message