| 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-2016 Eyeo GmbH | 4 # Copyright (C) 2006-2016 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, |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 for key in ('homepage', 'forum', 'blog', 'faq', 'contact', 'changelog',
'policy'): | 56 for key in ('homepage', 'forum', 'blog', 'faq', 'contact', 'changelog',
'policy'): |
| 57 url = getattr(subscription, key) | 57 url = getattr(subscription, key) |
| 58 if url != None: | 58 if url != None: |
| 59 urls[url] = True | 59 urls[url] = True |
| 60 for (title, url, complete) in subscription.variants: | 60 for (title, url, complete) in subscription.variants: |
| 61 urls[url] = True | 61 urls[url] = True |
| 62 | 62 |
| 63 pool = eventlet.GreenPool() | 63 pool = eventlet.GreenPool() |
| 64 for (url, result) in pool.imap(checkURL, urls.iterkeys()): | 64 for (url, result) in pool.imap(checkURL, urls.iterkeys()): |
| 65 urls[url] = result | 65 urls[url] = result |
| 66 if result == False: | 66 if result is False: |
| 67 sites[urlparse(url).netloc] = True | 67 sites[urlparse(url).netloc] = True |
| 68 for (site, result) in pool.imap(checkSite, sites.iterkeys()): | 68 for (site, result) in pool.imap(checkSite, sites.iterkeys()): |
| 69 sites[site] = result | 69 sites[site] = result |
| 70 | 70 |
| 71 result = [] | 71 result = [] |
| 72 for subscription in subscriptions: | 72 for subscription in subscriptions: |
| 73 s = {'name': subscription.name, 'links': []} | 73 s = {'name': subscription.name, 'links': []} |
| 74 result.append(s) | 74 result.append(s) |
| 75 for key in ('homepage', 'forum', 'blog', 'faq', 'contact', 'changelog',
'policy'): | 75 for key in ('homepage', 'forum', 'blog', 'faq', 'contact', 'changelog',
'policy'): |
| 76 url = getattr(subscription, key) | 76 url = getattr(subscription, key) |
| (...skipping 15 matching lines...) Expand all Loading... |
| 92 }) | 92 }) |
| 93 return result | 93 return result |
| 94 | 94 |
| 95 if __name__ == '__main__': | 95 if __name__ == '__main__': |
| 96 setupStderr() | 96 setupStderr() |
| 97 | 97 |
| 98 subscriptions = checkSubscriptions() | 98 subscriptions = checkSubscriptions() |
| 99 outputFile = get_config().get('subscriptions', 'statusPage') | 99 outputFile = get_config().get('subscriptions', 'statusPage') |
| 100 template = get_template(get_config().get('subscriptions', 'statusTemplate')) | 100 template = get_template(get_config().get('subscriptions', 'statusTemplate')) |
| 101 template.stream({'subscriptions': subscriptions}).dump(outputFile, encoding=
'utf-8') | 101 template.stream({'subscriptions': subscriptions}).dump(outputFile, encoding=
'utf-8') |
| OLD | NEW |