Fixed 404 page under werkzeug.routing
- Removed ?lang=<langcode> feature due to incompatibility with werkzeug routes in the current state of the architecture.
This commit is contained in:
parent
7742dcc1fb
commit
1ec7ff2adb
@ -15,7 +15,6 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import os
|
||||
import urllib
|
||||
import logging
|
||||
|
||||
from mediagoblin.routing import url_map, view_functions, add_route
|
||||
@ -138,7 +137,6 @@ class MediaGoblinApp(object):
|
||||
request.accept = request.accept_mimetypes
|
||||
|
||||
## Routing / controller loading stuff
|
||||
path_info = request.path
|
||||
map_adapter = self.url_map.bind_to_environ(request.environ)
|
||||
|
||||
# By using fcgi, mediagoblin can run under a base path
|
||||
@ -167,21 +165,9 @@ class MediaGoblinApp(object):
|
||||
request.db = self.db
|
||||
request.staticdirect = self.staticdirector
|
||||
|
||||
mg_request.setup_user_in_request(request)
|
||||
|
||||
try:
|
||||
endpoint, url_values = map_adapter.match()
|
||||
request.matchdict = url_values
|
||||
|
||||
request.locale = translate.get_locale_from_request(request)
|
||||
request.template_env = template.get_jinja_env(
|
||||
self.template_loader, request.locale)
|
||||
except NotFound as exc:
|
||||
return NotImplemented
|
||||
return render_404(request)(environ, start_response)
|
||||
except HTTPException as exc:
|
||||
# Support legacy webob.exc responses
|
||||
return exc(environ, start_response)
|
||||
request.locale = translate.get_locale_from_request(request)
|
||||
request.template_env = template.get_jinja_env(
|
||||
self.template_loader, request.locale)
|
||||
|
||||
def build_proxy(endpoint, **kw):
|
||||
try:
|
||||
@ -196,8 +182,23 @@ class MediaGoblinApp(object):
|
||||
|
||||
request.urlgen = build_proxy
|
||||
|
||||
mg_request.setup_user_in_request(request)
|
||||
|
||||
try:
|
||||
endpoint, url_values = map_adapter.match()
|
||||
request.matchdict = url_values
|
||||
except NotFound as exc:
|
||||
return render_404(request)(environ, start_response)
|
||||
except HTTPException as exc:
|
||||
# Support legacy webob.exc responses
|
||||
return exc(environ, start_response)
|
||||
|
||||
view_func = view_functions[endpoint]
|
||||
|
||||
_log.debug('endpoint: {0} view_func: {1}'.format(
|
||||
endpoint,
|
||||
view_func))
|
||||
|
||||
# import the endpoint, or if it's already a callable, call that
|
||||
if isinstance(view_func, unicode) \
|
||||
or isinstance(view_func, str):
|
||||
|
@ -14,7 +14,6 @@
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from routes.route import add_route
|
||||
from mediagoblin.routing import add_route
|
||||
|
||||
add_route('mediagoblin.auth.logout',
|
||||
@ -36,9 +35,10 @@ add_route('mediagoblin.auth.verify_email', '/verify_email/',
|
||||
add_route('mediagoblin.auth.resend_verification', '/resend_verification/',
|
||||
'mediagoblin.auth.views:resend_activation')
|
||||
|
||||
# XXX: Does this work?
|
||||
add_route('mediagoblin.auth.resend_verification_success',
|
||||
'/resend_verification_success/',
|
||||
template='mediagoblin/auth/resent_verification_email.html',
|
||||
# template='mediagoblin/auth/resent_verification_email.html',
|
||||
'mediagoblin.views:simple_template_render')
|
||||
|
||||
add_route('mediagoblin.auth.forgot_password', '/forgot_password/',
|
||||
|
@ -65,12 +65,7 @@ def get_locale_from_request(request):
|
||||
if request_form.has_key('lang'):
|
||||
return locale_to_lower_upper(request_form['lang'])
|
||||
|
||||
# Your routing can explicitly specify a target language
|
||||
matchdict = request.matchdict or {}
|
||||
|
||||
if 'locale' in matchdict:
|
||||
target_lang = matchdict['locale']
|
||||
elif 'target_lang' in request.session:
|
||||
if 'target_lang' in request.session:
|
||||
target_lang = request.session['target_lang']
|
||||
# Pull the first acceptable language or English
|
||||
else:
|
||||
|
@ -74,7 +74,7 @@ add_route('mediagoblin.user_pages.processing_panel',
|
||||
# Stray edit routes
|
||||
add_route('mediagoblin.edit.edit_media',
|
||||
'/u/<string:user>/m/<string:media>/edit/',
|
||||
'mediagoblin.user_pages.views:edit_media')
|
||||
'mediagoblin.edit.views:edit_media')
|
||||
|
||||
add_route('mediagoblin.edit.attachments',
|
||||
'/u/<string:user>/m/<string:media>/attachments/',
|
||||
|
Loading…
x
Reference in New Issue
Block a user