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

Delta Between Two Patch Sets: filters/find.py

Issue 5994668214976512: Issue 662 - Job links shouldn't use anchors (Closed)
Left Patch Set: Created March 21, 2015, 5:21 p.m.
Right Patch Set: Created March 23, 2015, 1:04 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 | includes/jobs/footer.tmpl » ('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 from jinja2 import environmentfilter, Environment 1 from jinja2 import environmentfilter
Wladimir Palant 2015/03/22 22:06:42 Nit: Environment isn't used. Not that it really ma
2 2
3 @environmentfilter 3 @environmentfilter
4 def find(environment, sequence, value, attr=None): 4 def find(environment, sequence, value, attribute=None):
Wladimir Palant 2015/03/22 22:06:42 Please keep attribute as the parameter name here,
saroyanm 2015/03/22 23:40:51 Done.
5 for item in sequence: 5 for item in sequence:
6 if (item if attr is None else environment.getitem(item, attr)) == value: 6 if (item if attribute is None else environment.getitem(item, attribute)) == value:
7 return item 7 return item
8 return None 8 return None
LEFTRIGHT

Powered by Google App Engine
This is Rietveld