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

Unified Diff: sitescripts/notifications/parser.py

Issue 29327106: Issue 3048 - Mark inactive notifications instead of removing them (Closed)
Patch Set: Created Sept. 10, 2015, 11:25 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sitescripts/notifications/parser.py
===================================================================
--- a/sitescripts/notifications/parser.py
+++ b/sitescripts/notifications/parser.py
@@ -118,15 +118,13 @@
data = codecs.getreader("utf8")(archive.extractfile(fileinfo))
try:
notification = _parse_notification(data, name)
- if "inactive" in notification:
- continue
- current_time = datetime.datetime.now()
- start = notification.pop("start", None)
- if start is not None and current_time < start:
- continue
- end = notification.pop("end", None)
- if end is not None and current_time > end:
- continue
+ if not "inactive" in notification:
+ current_time = datetime.datetime.now()
+ start = notification.pop("start", None)
+ end = notification.pop("end", None)
+ if ((start is not None and current_time < start) or
+ (end is not None and current_time > end)):
Sebastian Noack 2015/09/10 13:29:20 I think I found a way to simplify that logic: s
Felix Dahlke 2015/09/11 07:04:43 Indeed, that's much better - done.
+ notification["inactive"] = True
notifications.append(notification)
except:
traceback.print_exc()
« no previous file with comments | « no previous file | sitescripts/notifications/test/notification.py » ('j') | sitescripts/notifications/web/notification.py » ('J')

Powered by Google App Engine
This is Rietveld