From 03969d85210d13e10a8c41dc04c807089664cafd Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Fri, 10 Oct 2014 15:46:08 -0500 Subject: [PATCH] Bring back the ascii art goblin! For python 2 anyway. This does a "friendly" fallback where it skips the middleware on python 3. --- mediagoblin/errormiddleware.py | 8 ++++++-- paste.ini | 3 +-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/mediagoblin/errormiddleware.py b/mediagoblin/errormiddleware.py index c6789f32..da729d14 100644 --- a/mediagoblin/errormiddleware.py +++ b/mediagoblin/errormiddleware.py @@ -14,8 +14,6 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . -from paste.exceptions.errormiddleware import make_error_middleware - MGOBLIN_ERROR_MESSAGE = """\

YEOWCH... that's an error!

@@ -56,5 +54,11 @@ def mgoblin_error_middleware(app, global_conf, **kw): It should take all of Paste's default options, so see: http://pythonpaste.org/modules/exceptions.html """ + # No paste? Fail in a friendly way! + try: + from paste.exceptions.errormiddleware import make_error_middleware + except ImportError: + return app + kw['error_message'] = MGOBLIN_ERROR_MESSAGE return make_error_middleware(app, global_conf, **kw) diff --git a/paste.ini b/paste.ini index 77364c09..68fd9dea 100644 --- a/paste.ini +++ b/paste.ini @@ -6,8 +6,7 @@ debug = false [pipeline:main] -# pipeline = errors mediagoblin -pipeline = mediagoblin +pipeline = errors mediagoblin [app:mediagoblin] use = egg:mediagoblin#app -- 2.25.1