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, hashlib, Cookie | 18 import re, os, Cookie |
19 from datetime import date, timedelta, datetime | 19 from datetime import date, timedelta, datetime |
20 from urlparse import parse_qs | 20 from urlparse import parse_qs |
21 from sitescripts.reports.utils import getDigestSecret, getDigestSecret_compat | 21 from sitescripts.reports.utils import getDigestSecret, getDigestSecret_compat |
22 from sitescripts.utils import get_config, get_template, setupStderr | 22 from sitescripts.utils import get_config, get_template, setupStderr |
23 from sitescripts.web import url_handler | 23 from sitescripts.web import url_handler |
24 | 24 |
25 @url_handler('/digest') | 25 @url_handler('/digest') |
26 def handleRequest(environ, start_response): | 26 def handleRequest(environ, start_response): |
27 setupStderr(environ['wsgi.errors']) | 27 setupStderr(environ['wsgi.errors']) |
28 | 28 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 f = open(path) | 71 f = open(path) |
72 if 'wsgi.file_wrapper' in environ: | 72 if 'wsgi.file_wrapper' in environ: |
73 return environ['wsgi.file_wrapper'](f, blockSize) | 73 return environ['wsgi.file_wrapper'](f, blockSize) |
74 else: | 74 else: |
75 return iter(lambda: f.read(blockSize), '') | 75 return iter(lambda: f.read(blockSize), '') |
76 | 76 |
77 def showError(message, start_response): | 77 def showError(message, start_response): |
78 template = get_template(get_config().get('reports', 'errorTemplate')) | 78 template = get_template(get_config().get('reports', 'errorTemplate')) |
79 start_response('400 Processing Error', [('Content-Type', 'application/xhtml+xm
l; charset=utf-8')]) | 79 start_response('400 Processing Error', [('Content-Type', 'application/xhtml+xm
l; charset=utf-8')]) |
80 return [template.render({'message': message}).encode('utf-8')] | 80 return [template.render({'message': message}).encode('utf-8')] |
OLD | NEW |