Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: sitescripts/notifications/parser.py

Issue 29322888: Issue 2707 - Remove start/end from notifications (Closed)
Patch Set: Refactoring Created July 29, 2015, 2:29 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | sitescripts/notifications/test/parser.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 if name.startswith("./"): 115 if name.startswith("./"):
116 name = name[2:] 116 name = name[2:]
117 117
118 if fileinfo.type == tarfile.REGTYPE: 118 if fileinfo.type == tarfile.REGTYPE:
119 data = codecs.getreader("utf8")(archive.extractfile(fileinfo)) 119 data = codecs.getreader("utf8")(archive.extractfile(fileinfo))
120 try: 120 try:
121 notification = _parse_notification(data, name) 121 notification = _parse_notification(data, name)
122 if "inactive" in notification: 122 if "inactive" in notification:
123 continue 123 continue
124 current_time = datetime.datetime.now() 124 current_time = datetime.datetime.now()
125 if "start" in notification and current_time < notification["start"]: 125 start = notification.pop("start", None)
126 if start is not None and current_time < start:
126 continue 127 continue
127 if "end" in notification and current_time > notification["end"]: 128 end = notification.pop("end", None)
129 if end is not None and current_time > end:
128 continue 130 continue
129 notifications.append(notification) 131 notifications.append(notification)
130 except: 132 except:
131 traceback.print_exc() 133 traceback.print_exc()
132 return notifications 134 return notifications
OLDNEW
« no previous file with comments | « no previous file | sitescripts/notifications/test/parser.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld