Skip to content
Myr

Added middlewares to quickstart. This fixes #88

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Armin Ronacher · committed by Armin Ronacher · parent 91e9632 · Browse files · 3 files+22 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+22 added−2 removed

  • other:+22 added−2 removed

3 files+22 added−2 removed

modified:docs/quickstart.rst+11 added
732 unmodified lines
733734The attached :attr:`~flask.Flask.logger` is a standard logging735:class:`~logging.Logger`, so head over to the official stdlib736documentation for more information.737738Hooking in WSGI Middlewares739---------------------------740741If you want to add a WSGI middleware to your application you can wrap the742internal WSGI application. For example if you want to one of the743middlewares from the Werkzeug package to work around bugs in lighttpd, you744can do it like this::745746 from werkzeug.contrib.fixers import LighttpdCGIRootFix747 app.wsgi_app = LighttpdCGIRootFix(app.wsgi_app)
modified:flask/app.py+10 added
722 unmodified lines
723 if isinstance(rv, tuple):724 return self.response_class(*rv)725 return self.response_class.force_type(rv, request.environ)726727 def create_url_adapter(self, request):728 """Creates a URL adapter for the given request. The URL adapter729 is created at a point where the request context is not yet set up730 so the request is passed explicitly.731732 .. versionadded:: 0.6733 """734 return self.url_map.bind_to_environ(request.environ,735 server_name=self.config['SERVER_NAME'])736737 def preprocess_request(self):738 """Called before the actual request dispatching and will739 call every as :meth:`before_request` decorated function.740 If any of these function returns a value it's handled as
129 unmodified lines
modified:flask/ctx.py+1 added-2 removed
26 unmodified lines
27 """2829 def __init__(self, app, environ):30 self.app = app31 self.url_adapter = app.url_map.bind_to_environ(environ,32 server_name=app.config['SERVER_NAME'])31 self.request = app.request_class(environ)32 self.url_adapter = app.create_url_adapter(self.request)33 self.session = app.open_session(self.request)34 if self.session is None:35 self.session = _NullSession()36 self.g = _RequestGlobals()
30 unmodified lines