Left: | ||
Right: |
OLD | NEW |
---|---|
(Empty) | |
1 from jinja2 import environmentfilter, Environment | |
Wladimir Palant
2015/03/22 22:06:42
Nit: Environment isn't used. Not that it really ma
| |
2 | |
3 @environmentfilter | |
4 def find(environment, sequence, value, attr=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: | |
6 if (item if attr is None else environment.getitem(item, attr)) == value: | |
7 return item | |
8 return None | |
OLD | NEW |