return request.get_response(redirect)(environ, start_response)
# Okay, no matches. 404 time!
- return exc.HTTPNotFound()(environ, start_response)
+ return util.render_404(request)(environ, start_response)
controller = util.import_component(route_match['controller'])
request.start_response = start_response
accept_lang_matches = request.accept_language.best_matches()
# Your routing can explicitly specify a target language
- if request.matchdict.has_key('locale'):
- target_lang = request.matchdict['locale']
+ matchdict = request.matchdict or {}
+
+ if matchdict.has_key('locale'):
+ target_lang = matchdict['locale']
elif request.session.has_key('target_lang'):
target_lang = request.session['target_lang']
# Pull the first acceptable language
the number of columns in the list
"""
return gridify_list(list(this_cursor), num_cols)
+
+
+def render_404(request):
+ """
+ Render a 404.
+ """
+ return render_to_response(
+ request, 'mediagoblin/404.html', {}, status=400)