diff options
author | Christopher Allan Webber <cwebber@dustycloud.org> | 2011-08-22 21:48:45 -0500 |
---|---|---|
committer | Christopher Allan Webber <cwebber@dustycloud.org> | 2011-08-22 21:48:45 -0500 |
commit | 894fa564e718af7398f6f368eb3ac0dcb4d45e1f (patch) | |
tree | 9508a08f8d6598d1040cea44287c0e42af1a1ad6 /mediagoblin/app.py | |
parent | 3a8c3a38559f2f81d6155c2349fcddc5ecd6ef28 (diff) | |
parent | 132aa9d97a32abfe86bc5de3ea4e2fa62ddc3793 (diff) | |
download | mediagoblin-894fa564e718af7398f6f368eb3ac0dcb4d45e1f.tar.lz mediagoblin-894fa564e718af7398f6f368eb3ac0dcb4d45e1f.tar.xz mediagoblin-894fa564e718af7398f6f368eb3ac0dcb4d45e1f.zip |
Merge branch 'master' into jwandborg-f482_media_attachments
Conflicts:
mediagoblin/config_spec.ini
mediagoblin/edit/forms.py
mediagoblin/edit/views.py
mediagoblin/submit/views.py
mediagoblin/templates/mediagoblin/user_pages/media.html
Diffstat (limited to 'mediagoblin/app.py')
-rw-r--r-- | mediagoblin/app.py | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/mediagoblin/app.py b/mediagoblin/app.py index c1ee3d77..3030929d 100644 --- a/mediagoblin/app.py +++ b/mediagoblin/app.py @@ -101,6 +101,23 @@ class MediaGoblinApp(object): ## Routing / controller loading stuff route_match = self.routing.match(path_info) + ## Attach utilities to the request object + request.matchdict = route_match + request.urlgen = routes.URLGenerator(self.routing, environ) + # Do we really want to load this via middleware? Maybe? + request.session = request.environ['beaker.session'] + # Attach self as request.app + # Also attach a few utilities from request.app for convenience? + request.app = self + request.locale = util.get_locale_from_request(request) + + request.template_env = util.get_jinja_env( + self.template_loader, request.locale) + request.db = self.db + request.staticdirect = self.staticdirector + + util.setup_user_in_request(request) + # No matching page? if route_match is None: # Try to do see if we have a match with a trailing slash @@ -116,28 +133,12 @@ class MediaGoblinApp(object): return request.get_response(redirect)(environ, start_response) # Okay, no matches. 404 time! - return exc.HTTPNotFound()(environ, start_response) + request.matchdict = {} # in case our template expects it + return util.render_404(request)(environ, start_response) controller = util.import_component(route_match['controller']) request.start_response = start_response - ## Attach utilities to the request object - request.matchdict = route_match - request.urlgen = routes.URLGenerator(self.routing, environ) - # Do we really want to load this via middleware? Maybe? - request.session = request.environ['beaker.session'] - # Attach self as request.app - # Also attach a few utilities from request.app for convenience? - request.app = self - request.locale = util.get_locale_from_request(request) - - request.template_env = util.get_jinja_env( - self.template_loader, request.locale) - request.db = self.db - request.staticdirect = self.staticdirector - - util.setup_user_in_request(request) - return controller(request)(environ, start_response) |