1 # GNU MediaGoblin -- federated, autonomous media hosting
2 # Copyright (C) 2011, 2012 MediaGoblin contributors. See AUTHORS.
4 # This program is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU Affero General Public License as published by
6 # the Free Software Foundation, either version 3 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU Affero General Public License for more details.
14 # You should have received a copy of the GNU Affero General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 MGOBLIN_ERROR_MESSAGE
= """\
18 <div style="text-align:center;font-family: monospace">
19 <h1>YEOWCH... that's an error!</h1>
21 .-------------------------.
36 '-------------------------'
38 <p>Something bad happened, and things broke.</p>
39 <p>If this is not your website, you may want to alert the owner.</p>
42 Powered... er broken... by
43 <a href="http://www.mediagoblin.org">MediaGoblin</a>,
44 a <a href="http://www.gnu.org">GNU Project</a>.
49 def mgoblin_error_middleware(app
, global_conf
, **kw
):
51 MediaGoblin wrapped error middleware.
53 This is really just wrapping the error middleware from Paste.
54 It should take all of Paste's default options, so see:
55 http://pythonpaste.org/modules/exceptions.html
57 # No paste? Fail in a friendly way!
59 from paste
.exceptions
.errormiddleware
import make_error_middleware
63 kw
['error_message'] = MGOBLIN_ERROR_MESSAGE
64 return make_error_middleware(app
, global_conf
, **kw
)