| 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, | 
|  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 codecs |  18 import codecs | 
|  19 import json |  19 import json | 
|  20  |  20  | 
|  21 from sitescripts.notifications.parser import load_notifications |  21 from sitescripts.notifications.parser import load_notifications | 
|  22 from sitescripts.utils import get_config, setupStderr |  22 from sitescripts.utils import get_config, setupStderr | 
|  23  |  23  | 
|  24 def generate_notifications(path): |  24 def generate_notifications(path): | 
|  25   notifications = load_notifications() |  25   notifications = load_notifications() | 
 |  26   # Ignoring notifications with variants here - we can only process those in a | 
 |  27   # URL handler. | 
 |  28   notifications["notifications"] = [x for x in notifications | 
 |  29                                     if "variants" not in x] | 
|  26   with codecs.open(path, "wb", encoding="utf-8") as file: |  30   with codecs.open(path, "wb", encoding="utf-8") as file: | 
|  27     json.dump(notifications, file, ensure_ascii=False, indent=2, |  31     json.dump(notifications, file, ensure_ascii=False, indent=2, | 
|  28         separators=(',', ': '), sort_keys=True) |  32         separators=(',', ': '), sort_keys=True) | 
|  29  |  33  | 
|  30 if __name__ == "__main__": |  34 if __name__ == "__main__": | 
|  31   setupStderr() |  35   setupStderr() | 
|  32   output = get_config().get("notifications", "output") |  36   output = get_config().get("notifications", "output") | 
|  33   generate_notifications(output) |  37   generate_notifications(output) | 
| OLD | NEW |