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: Simplify range selection and inactive check Created Sept. 11, 2015, 7:03 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
« no previous file with comments | « no previous file | sitescripts/notifications/test/notification.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sitescripts/notifications/parser.py
===================================================================
--- a/sitescripts/notifications/parser.py
+++ b/sitescripts/notifications/parser.py
@@ -118,15 +118,12 @@
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", current_time)
+ end = notification.pop("end", current_time)
+ if not start <= current_time <= end:
+ notification["inactive"] = True
notifications.append(notification)
except:
traceback.print_exc()
« no previous file with comments | « no previous file | sitescripts/notifications/test/notification.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld