Fixing typo: notifiction->notification
[larjonas-mediagoblin.git] / mediagoblin / errormiddleware.py
blobda729d145f1ec57d7ef560b077a41a5126a9c672
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>
20 <pre>
21 .-------------------------.
22 | __ _ |
23 | -, \_,------,_// |
24 | <\ ,-- --.\ |
25 | / (x ) ( X ) |
26 | ' '--, ,--'\ |
27 | / \ -v-v-u-v / |
28 | . '.__.--__'.\ |
29 | / ',___/ / \__/' |
30 | | | ,'\_'/, || |
31 | \_| | | | | || |
32 | W',_ ||| |||_'' |
33 | | '------'| |
34 | |__| |_|_ |
35 | ,,,-' '-,,, |
36 '-------------------------'
37 </pre>
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>
40 <br><br>
41 <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>.
45 </p>
46 </div>"""
49 def mgoblin_error_middleware(app, global_conf, **kw):
50 """
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
56 """
57 # No paste? Fail in a friendly way!
58 try:
59 from paste.exceptions.errormiddleware import make_error_middleware
60 except ImportError:
61 return app
63 kw['error_message'] = MGOBLIN_ERROR_MESSAGE
64 return make_error_middleware(app, global_conf, **kw)