Standard middleware
class LoggerMiddleware(object): '''WSGI middleware''' def __init__(self, application): self.app = application def __call__(self, environ, start_response):
In the pyramid that creates the application code:
from paste.httpserver import serve from pyramid.response import Response from pyramid.view import view_config @view_config() def hello(request): return Response('Hello') if __name__ == '__main__': from pyramid.config import Configurator config = Configurator() config.scan() app = config.make_wsgi_app()
source share