OLD | NEW |
1 # coding: utf-8 | 1 # coding: utf-8 |
2 | 2 |
3 # This file is part of the Adblock Plus web scripts, | 3 # This file is part of the Adblock Plus web scripts, |
4 # Copyright (C) 2006-2015 Eyeo GmbH | 4 # Copyright (C) 2006-2015 Eyeo GmbH |
5 # | 5 # |
6 # Adblock Plus is free software: you can redistribute it and/or modify | 6 # Adblock Plus is free software: you can redistribute it and/or modify |
7 # it under the terms of the GNU General Public License version 3 as | 7 # it under the terms of the GNU General Public License version 3 as |
8 # published by the Free Software Foundation. | 8 # published by the Free Software Foundation. |
9 # | 9 # |
10 # Adblock Plus is distributed in the hope that it will be useful, | 10 # Adblock Plus is distributed in the hope that it will be useful, |
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 # GNU General Public License for more details. | 13 # GNU General Public License for more details. |
14 # | 14 # |
15 # You should have received a copy of the GNU General Public License | 15 # You should have received a copy of the GNU General Public License |
16 # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 16 # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 |
18 import mimetypes | 18 import mimetypes |
19 import os | 19 import os |
20 import sys | 20 import sys |
21 | 21 |
22 import jinja2 | 22 import jinja2 |
23 | 23 |
24 from ..utils import process_page | 24 from cms.utils import process_page |
25 from ..sources import FileSource | 25 from cms.sources import FileSource |
26 from ..converters import converters | 26 from cms.converters import converters |
27 | 27 |
28 source = None | 28 source = None |
29 | 29 |
30 UNICODE_ENCODING = "utf-8" | 30 UNICODE_ENCODING = "utf-8" |
31 | 31 |
32 ERROR_TEMPLATE = """ | 32 ERROR_TEMPLATE = """ |
33 <html> | 33 <html> |
34 <head> | 34 <head> |
35 <title>{{status}}</title> | 35 <title>{{status}}</title> |
36 </head> | 36 </head> |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 return app(environ, start_response) | 125 return app(environ, start_response) |
126 except Exception, e: | 126 except Exception, e: |
127 return show_error(start_response, "500 Internal Server Error", | 127 return show_error(start_response, "500 Internal Server Error", |
128 uri=environ.get("PATH_INFO"), error=e) | 128 uri=environ.get("PATH_INFO"), error=e) |
129 | 129 |
130 server = make_server(host, port, wrapper) | 130 server = make_server(host, port, wrapper) |
131 print " * Running on http://%s:%i/" % server.server_address | 131 print " * Running on http://%s:%i/" % server.server_address |
132 server.serve_forever() | 132 server.serve_forever() |
133 | 133 |
134 run("localhost", 5000, handler, use_reloader=True, use_debugger=True) | 134 run("localhost", 5000, handler, use_reloader=True, use_debugger=True) |
OLD | NEW |