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

Delta Between Two Patch Sets: sitescripts/notifications/parser.py

Issue 29322888: Issue 2707 - Remove start/end from notifications (Closed)
Left Patch Set: Created July 29, 2015, 10:43 a.m.
Right 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:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | sitescripts/notifications/test/parser.py » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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: 125 start = notification.pop("start", None)
Felix Dahlke 2015/07/29 10:45:11 Not entirely sure on how to best change this. This
Sebastian Noack 2015/07/29 11:28:54 This wouldn't be the same. With this patch you onl
Felix Dahlke 2015/07/29 14:30:17 Yeah it's fine to always remove them. I'll do it t
126 if current_time < notification["start"]: 126 if start is not None and current_time < start:
127 continue 127 continue
128 notification.pop("start", None) 128 end = notification.pop("end", None)
129 if "end" in notification: 129 if end is not None and current_time > end:
130 if current_time > notification["end"]: 130 continue
131 continue
132 notification.pop("end", None)
133 notifications.append(notification) 131 notifications.append(notification)
134 except: 132 except:
135 traceback.print_exc() 133 traceback.print_exc()
136 return notifications 134 return notifications
LEFTRIGHT

Powered by Google App Engine
This is Rietveld