| OLD | NEW |
| 1 # This file is part of the Adblock Plus web scripts, | 1 # This file is part of the Adblock Plus web scripts, |
| 2 # Copyright (C) 2006-present eyeo GmbH | 2 # Copyright (C) 2006-present eyeo GmbH |
| 3 # | 3 # |
| 4 # Adblock Plus is free software: you can redistribute it and/or modify | 4 # Adblock Plus is free software: you can redistribute it and/or modify |
| 5 # it under the terms of the GNU General Public License version 3 as | 5 # it under the terms of the GNU General Public License version 3 as |
| 6 # published by the Free Software Foundation. | 6 # published by the Free Software Foundation. |
| 7 # | 7 # |
| 8 # Adblock Plus is distributed in the hope that it will be useful, | 8 # Adblock Plus is distributed in the hope that it will be useful, |
| 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 reportData['referrer'] = attributes.get('referrer', '') | 139 reportData['referrer'] = attributes.get('referrer', '') |
| 140 elif name == 'request': | 140 elif name == 'request': |
| 141 try: | 141 try: |
| 142 requestCount = int(attributes['count']) | 142 requestCount = int(attributes['count']) |
| 143 except: | 143 except: |
| 144 requestCount = 1 | 144 requestCount = 1 |
| 145 reportData['requests'].append({ | 145 reportData['requests'].append({ |
| 146 'location': attributes.get('location', ''), | 146 'location': attributes.get('location', ''), |
| 147 'type': attributes.get('type', 'unknown'), | 147 'type': attributes.get('type', 'unknown'), |
| 148 'docDomain': attributes.get('docDomain', 'unknown'), | 148 'docDomain': attributes.get('docDomain', 'unknown'), |
| 149 'thirdParty': (attributes.get('thirdParty', 'false') == 'true'), | 149 'thirdParty': attributes.get('thirdParty', 'false') == 'true', |
| 150 'size': attributes.get('size', ''), | 150 'size': attributes.get('size', ''), |
| 151 'filter': attributes.get('filter', ''), | 151 'filter': attributes.get('filter', ''), |
| 152 'count': requestCount, | 152 'count': requestCount, |
| 153 'tagName': attributes.get('node', ''), | 153 'tagName': attributes.get('node', ''), |
| 154 }) | 154 }) |
| 155 elif name == 'filter': | 155 elif name == 'filter': |
| 156 reportData['filters'].append({ | 156 reportData['filters'].append({ |
| 157 'text': attributes.get('text', 'unknown'), | 157 'text': attributes.get('text', 'unknown'), |
| 158 'subscriptions': map(translateSubscriptionName, attributes.get('subs
criptions', 'unknown').split(' ')), | 158 'subscriptions': map(translateSubscriptionName, attributes.get('subs
criptions', 'unknown').split(' ')), |
| 159 'hitCount': attributes.get('hitCount', 'unknown'), | 159 'hitCount': attributes.get('hitCount', 'unknown'), |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 elif isinstance(data[key], basestring): | 280 elif isinstance(data[key], basestring): |
| 281 limit = lengthRestrictions.get(keyPath, lengthRestrictions['default_
string']) | 281 limit = lengthRestrictions.get(keyPath, lengthRestrictions['default_
string']) |
| 282 if len(data[key]) > limit: | 282 if len(data[key]) > limit: |
| 283 data[key] = data[key][0:limit] + u'\u2026' | 283 data[key] = data[key][0:limit] + u'\u2026' |
| 284 reportData['warnings'][keyPath] = 'Field %s exceeded length limi
t and was truncated' % keyPath | 284 reportData['warnings'][keyPath] = 'Field %s exceeded length limi
t and was truncated' % keyPath |
| 285 | 285 |
| 286 | 286 |
| 287 if __name__ == '__main__': | 287 if __name__ == '__main__': |
| 288 setupStderr() | 288 setupStderr() |
| 289 scanReports(get_config().get('reports', 'dataPath')) | 289 scanReports(get_config().get('reports', 'dataPath')) |
| OLD | NEW |