Mercurial > kallithea
comparison pylons_app/config/middleware.py @ 204:a8ea3ce3cdc4
Created middleware package. Crated special middleware to handle https requests redirections.
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Sun, 23 May 2010 00:54:22 +0200 |
parents | be6d8aaddbd1 |
children | 8bdec09436cb |
comparison
equal
deleted
inserted
replaced
203:be6d8aaddbd1 | 204:a8ea3ce3cdc4 |
---|---|
5 from paste.urlparser import StaticURLParser | 5 from paste.urlparser import StaticURLParser |
6 from paste.deploy.converters import asbool | 6 from paste.deploy.converters import asbool |
7 from pylons.middleware import ErrorHandler, StatusCodeRedirect | 7 from pylons.middleware import ErrorHandler, StatusCodeRedirect |
8 from pylons.wsgiapp import PylonsApp | 8 from pylons.wsgiapp import PylonsApp |
9 from routes.middleware import RoutesMiddleware | 9 from routes.middleware import RoutesMiddleware |
10 from pylons_app.lib.simplehg import SimpleHg | 10 from pylons_app.lib.middleware.simplehg import SimpleHg |
11 from pylons_app.lib.middleware.https_fixup import HttpsFixup | |
11 from pylons_app.config.environment import load_environment | 12 from pylons_app.config.environment import load_environment |
12 | 13 |
13 def make_app(global_conf, full_stack=True, static_files=True, **app_conf): | 14 def make_app(global_conf, full_stack=True, static_files=True, **app_conf): |
14 """Create a Pylons WSGI application and return it | 15 """Create a Pylons WSGI application and return it |
15 | 16 |
39 | 40 |
40 # Routing/Session/Cache Middleware | 41 # Routing/Session/Cache Middleware |
41 app = RoutesMiddleware(app, config['routes.map']) | 42 app = RoutesMiddleware(app, config['routes.map']) |
42 app = SessionMiddleware(app, config) | 43 app = SessionMiddleware(app, config) |
43 | 44 |
44 # CUSTOM MIDDLEWARE HERE (filtered by error handling middlewares) | 45 # CUSTOM MIDDLEWARE HERE (filtered by error handling middlewares) |
46 #set the https based on HTTP_X_URL_SCHEME | |
47 app = HttpsFixup(app) | |
45 app = SimpleHg(app, config) | 48 app = SimpleHg(app, config) |
46 | 49 |
47 if asbool(full_stack): | 50 if asbool(full_stack): |
48 # Handle Python exceptions | 51 # Handle Python exceptions |
49 app = ErrorHandler(app, global_conf, **config['pylons.errorware']) | 52 app = ErrorHandler(app, global_conf, **config['pylons.errorware']) |