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-2014 Eyeo GmbH | 4 # Copyright (C) 2006-2014 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 re, os, sys | 18 import re, os |
19 from urlparse import parse_qs | 19 from urlparse import parse_qs |
20 from sitescripts.utils import get_config, get_template, setupStderr | 20 from sitescripts.utils import get_config, get_template, setupStderr |
21 from sitescripts.web import url_handler | 21 from sitescripts.web import url_handler |
22 import sitescripts.subscriptions.knownIssuesParser as knownIssuesParser | 22 import sitescripts.subscriptions.knownIssuesParser as knownIssuesParser |
23 | 23 |
24 def dataIterator(source, file): | 24 def dataIterator(source, file): |
25 for line in source: | 25 for line in source: |
26 file.write(line) | 26 file.write(line) |
27 yield line | 27 yield line |
28 | 28 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 raise e | 66 raise e |
67 | 67 |
68 template = get_template(get_config().get('reports', 'submitResponseTemplate')) | 68 template = get_template(get_config().get('reports', 'submitResponseTemplate')) |
69 start_response('200 OK', [('Content-Type', 'application/xhtml+xml; charset=utf
-8')]) | 69 start_response('200 OK', [('Content-Type', 'application/xhtml+xml; charset=utf
-8')]) |
70 return [template.render({'url': get_config().get('reports', 'urlRoot') + guid,
'knownIssues': knownIssues}).encode('utf-8')] | 70 return [template.render({'url': get_config().get('reports', 'urlRoot') + guid,
'knownIssues': knownIssues}).encode('utf-8')] |
71 | 71 |
72 def showError(message, start_response): | 72 def showError(message, start_response): |
73 template = get_template(get_config().get('reports', 'errorTemplate')) | 73 template = get_template(get_config().get('reports', 'errorTemplate')) |
74 start_response('400 Processing Error', [('Content-Type', 'application/xhtml+xm
l; charset=utf-8')]) | 74 start_response('400 Processing Error', [('Content-Type', 'application/xhtml+xm
l; charset=utf-8')]) |
75 return [template.render({'message': message}).encode('utf-8')] | 75 return [template.render({'message': message}).encode('utf-8')] |
OLD | NEW |