Skip to content
This repository has been archived by the owner on Oct 1, 2020. It is now read-only.

Commit

Permalink
simple is better than complicated
Browse files Browse the repository at this point in the history
  • Loading branch information
rochacbruno committed Nov 30, 2015
1 parent 52f49ba commit 96962dd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -16,7 +16,7 @@ install:

.PHONY: pep8
pep8:
@flake8 quokka --ignore=F403,E901 --exclude=migrations
@flake8 quokka --ignore=F403 --exclude=migrations

.PHONY: sdist
sdist: test
Expand Down
15 changes: 3 additions & 12 deletions quokka/ext/error_handlers.py
@@ -1,5 +1,4 @@
# coding: utf-8
import sys
from quokka.core.templates import render_template


Expand Down Expand Up @@ -53,16 +52,8 @@ def server_error_page(error):
# URLBUILD Error Handlers
def admin_icons_error_handler(error, endpoint, values):
"when some of default dashboard button is deactivated, avoids error"
icons_endpoints = [
item[0] for item in app.config.get('ADMIN_ICONS', [])
]
if endpoint not in icons_endpoints:
exc_type, exc_value, tb = sys.exc_info()
if exc_value is error:
raise exc_type, exc_value, tb # noqa
else:
raise error
# admin home, instead of raising BuildError.
return '/admin'
if endpoint in [item[0] for item in app.config.get('ADMIN_ICONS', [])]:
return '/admin'
raise error

app.url_build_error_handlers.append(admin_icons_error_handler)

0 comments on commit 96962dd

Please sign in to comment.