| 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-2015 Eyeo GmbH | 4 # Copyright (C) 2006-2015 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 | 62 |
| 63 if line.find("=") < 0: | 63 if line.find("=") < 0: |
| 64 raise Exception("Could not process line '%s' in file '%s'" % (line.strip()
, name)) | 64 raise Exception("Could not process line '%s' in file '%s'" % (line.strip()
, name)) |
| 65 | 65 |
| 66 key, value = map(unicode.strip, line.split("=", 1)) | 66 key, value = map(unicode.strip, line.split("=", 1)) |
| 67 is_variant = current != notification | 67 is_variant = current != notification |
| 68 | 68 |
| 69 if key == "inactive" and not is_variant: | 69 if key == "inactive" and not is_variant: |
| 70 current["inactive"] = True | 70 current["inactive"] = True |
| 71 elif key == "severity": | 71 elif key == "severity": |
| 72 if value not in ("information", "critical"): | 72 if value not in ("information", "critical", "normal"): |
| 73 raise Exception("Unknown severity value '%s' in file '%s'" % (value, nam
e)) | 73 raise Exception("Unknown severity value '%s' in file '%s'" % (value, nam
e)) |
| 74 current["severity"] = value | 74 current["severity"] = value |
| 75 elif key == "links": | 75 elif key == "links": |
| 76 current["links"] = value.split() | 76 current["links"] = value.split() |
| 77 elif key.startswith("title."): | 77 elif key.startswith("title."): |
| 78 locale = key[len("title."):] | 78 locale = key[len("title."):] |
| 79 current["title"][locale] = value | 79 current["title"][locale] = value |
| 80 elif key.startswith("message."): | 80 elif key.startswith("message."): |
| 81 locale = key[len("message."):] | 81 locale = key[len("message."):] |
| 82 current["message"][locale] = value | 82 current["message"][locale] = value |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 if not "inactive" in notification: | 121 if not "inactive" in notification: |
| 122 current_time = datetime.datetime.now() | 122 current_time = datetime.datetime.now() |
| 123 start = notification.pop("start", current_time) | 123 start = notification.pop("start", current_time) |
| 124 end = notification.pop("end", current_time) | 124 end = notification.pop("end", current_time) |
| 125 if not start <= current_time <= end: | 125 if not start <= current_time <= end: |
| 126 notification["inactive"] = True | 126 notification["inactive"] = True |
| 127 notifications.append(notification) | 127 notifications.append(notification) |
| 128 except: | 128 except: |
| 129 traceback.print_exc() | 129 traceback.print_exc() |
| 130 return notifications | 130 return notifications |
| OLD | NEW |