comparison rhodecode/config/middleware.py @ 635:fd63782c4426 beta

Fixed age, for new vcs implementation. Removed all obsolete date formatters Added simplegit middleware. fixed deps added scm type icon to main page
author Marcin Kuzminski <marcin@python-works.com>
date Mon, 25 Oct 2010 03:19:01 +0200
parents 1e757ac98988
children a9158dfa05cc
comparison
equal deleted inserted replaced
634:0d18cf02278a 635:fd63782c4426
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 rhodecode.lib.middleware.simplehg import SimpleHg 10 from rhodecode.lib.middleware.simplehg import SimpleHg
11 from rhodecode.lib.middleware.simplegit import SimpleGit
11 from rhodecode.lib.middleware.https_fixup import HttpsFixup 12 from rhodecode.lib.middleware.https_fixup import HttpsFixup
12 from rhodecode.config.environment import load_environment 13 from rhodecode.config.environment import load_environment
13 14
14 def make_app(global_conf, full_stack=True, static_files=True, **app_conf): 15 def make_app(global_conf, full_stack=True, static_files=True, **app_conf):
15 """Create a Pylons WSGI application and return it 16 """Create a Pylons WSGI application and return it
33 # Configure the Pylons environment 34 # Configure the Pylons environment
34 config = load_environment(global_conf, app_conf) 35 config = load_environment(global_conf, app_conf)
35 36
36 # The Pylons WSGI app 37 # The Pylons WSGI app
37 app = PylonsApp(config=config) 38 app = PylonsApp(config=config)
38 39
39 # Routing/Session/Cache Middleware 40 # Routing/Session/Cache Middleware
40 app = RoutesMiddleware(app, config['routes.map']) 41 app = RoutesMiddleware(app, config['routes.map'])
41 app = SessionMiddleware(app, config) 42 app = SessionMiddleware(app, config)
42 43
43 # CUSTOM MIDDLEWARE HERE (filtered by error handling middlewares) 44 # CUSTOM MIDDLEWARE HERE (filtered by error handling middlewares)
44 45
45 app = SimpleHg(app, config) 46 app = SimpleHg(app, config)
46 47 app = SimpleGit(app, config)
48
47 if asbool(full_stack): 49 if asbool(full_stack):
48 # Handle Python exceptions 50 # Handle Python exceptions
49 app = ErrorHandler(app, global_conf, **config['pylons.errorware']) 51 app = ErrorHandler(app, global_conf, **config['pylons.errorware'])
50 52
51 # Display error documents for 401, 403, 404 status codes (and 53 # Display error documents for 401, 403, 404 status codes (and
52 # 500 when debug is disabled) 54 # 500 when debug is disabled)
53 if asbool(config['debug']): 55 if asbool(config['debug']):
54 app = StatusCodeRedirect(app) 56 app = StatusCodeRedirect(app)
55 else: 57 else:
56 app = StatusCodeRedirect(app, [400, 401, 403, 404, 500]) 58 app = StatusCodeRedirect(app, [400, 401, 403, 404, 500])
57 59
58 #enable https redirets based on HTTP_X_URL_SCHEME set by proxy 60 #enable https redirets based on HTTP_X_URL_SCHEME set by proxy
59 app = HttpsFixup(app) 61 app = HttpsFixup(app)
60 62
61 # Establish the Registry for this application 63 # Establish the Registry for this application
62 app = RegistryManager(app) 64 app = RegistryManager(app)
63 65
64 if asbool(static_files): 66 if asbool(static_files):
65 # Serve static files 67 # Serve static files
66 static_app = StaticURLParser(config['pylons.paths']['static_files']) 68 static_app = StaticURLParser(config['pylons.paths']['static_files'])
67 app = Cascade([static_app, app]) 69 app = Cascade([static_app, app])
68 70
69 app.config = config 71 app.config = config
70 72
71 return app 73 return app
72 74