Made change_theme() more stable (so 404 pages render properly)

This commit is contained in:
str4d
2012-12-19 12:25:19 +00:00
parent 30876c09f3
commit c7b8d77da0

View File

@@ -243,9 +243,14 @@ def utility_processor():
# Change the theme of the current page
def change_theme(theme):
args = request.view_args.copy()
args = {}
if request.view_args:
args = request.view_args.copy()
args['theme'] = theme
return url_for(request.endpoint, **args)
if request.endpoint:
return url_for(request.endpoint, **args)
# Probably a 404 error page
return url_for('main_index', **args)
return dict(i2pconv=convert_url_to_clearnet,
url_for_other_page=url_for_other_page,