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-2013 Eyeo GmbH | 4 # Copyright (C) 2006-2013 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 sys, os, flask | 18 import sys, os, flask |
19 from ...utils import setupStderr | 19 from ...utils import setupStderr |
20 from ..utils import process_page | 20 from ..utils import process_page |
21 from ..sources import FileSource | 21 from ..sources import FileSource |
22 from ..converters import converters | 22 from ..converters import converters |
23 | 23 |
24 app = flask.Flask("sitescripts.web.bin.test_server") | 24 app = flask.Flask("sitescripts.cms.bin.test_server") |
25 source = None | 25 source = None |
26 | 26 |
27 def get_data(path): | 27 def get_data(path): |
28 if source.has_static(path): | 28 if source.has_static(path): |
29 return source.read_static(path) | 29 return source.read_static(path) |
30 | 30 |
31 path = path.rstrip("/") | 31 path = path.rstrip("/") |
32 if path == "": | 32 if path == "": |
33 path = source.read_config().get("general", "defaultlocale") | 33 path = source.read_config().get("general", "defaultlocale") |
34 if "/" not in path: | 34 if "/" not in path: |
(...skipping 30 matching lines...) Expand all Loading... |
65 | 65 |
66 if __name__ == "__main__": | 66 if __name__ == "__main__": |
67 setupStderr() | 67 setupStderr() |
68 if len(sys.argv) < 2: | 68 if len(sys.argv) < 2: |
69 print >>sys.stderr, "Usage: %s source_dir" % sys.argv[0] | 69 print >>sys.stderr, "Usage: %s source_dir" % sys.argv[0] |
70 sys.exit(1) | 70 sys.exit(1) |
71 | 71 |
72 source = FileSource(sys.argv[1]) | 72 source = FileSource(sys.argv[1]) |
73 | 73 |
74 # Make sure to "fix" argv to ensure that restart can succeed | 74 # Make sure to "fix" argv to ensure that restart can succeed |
75 sys.argv[0:1] = ["-m", "sitescripts.web.bin.test_server"] | 75 sys.argv[0:1] = ["-m", "sitescripts.cms.bin.test_server"] |
76 | 76 |
77 app.run(debug=True) | 77 app.run(debug=True) |
OLD | NEW |