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

Unified Diff: sitescripts/notifications/web/notification.py

Issue 29329851: Issue 3216 - Prevent StopIteration exception (Closed)
Patch Set: Created Nov. 9, 2015, 9:16 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 | « sitescripts/notifications/test/notification.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sitescripts/notifications/web/notification.py
===================================================================
--- a/sitescripts/notifications/web/notification.py
+++ b/sitescripts/notifications/web/notification.py
@@ -59,7 +59,9 @@
variant = group["variant"]
if variant == 0:
continue
- notification = next(x for x in notifications if x["id"] == group_id)
+ notification = next((x for x in notifications if x["id"] == group_id), None)
+ if not notification:
+ continue
notification = copy.deepcopy(notification)
notification.update(notification["variants"][variant - 1])
for key_to_remove in ("sample", "variants"):
« no previous file with comments | « sitescripts/notifications/test/notification.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld