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

Side by Side Diff: filters/find.py

Issue 5994668214976512: Issue 662 - Job links shouldn't use anchors (Closed)
Patch Set: Created March 22, 2015, 11:38 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | includes/jobs/footer.tmpl » ('j') | templates/default.tmpl » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 def getattribute(obj, attribute):
2 try:
3 return getattr(obj, str(attribute))
4 except AttributeError:
5 return obj[attribute]
6
7 def find(sequence, value, attribute=None):
8 for item in sequence:
9 if (item if attribute is None else getattribute(item, attribute)) == value:
10 return item
11 return None
OLDNEW
« no previous file with comments | « no previous file | includes/jobs/footer.tmpl » ('j') | templates/default.tmpl » ('J')

Powered by Google App Engine
This is Rietveld