Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Fix for groupby on tuple lists #40

wants to merge 1 commit into from

2 participants


Before this commit: 9573b66#jinja2/
groupby worked on tuple list by specifying tuple index in groupby :

[("a", "foo"), ("b", "bar"), ("a", "baz")] | groupby(0)

Not trying to check '.' presence in non iterable fixes this problem

@mitsuhiko mitsuhiko closed this in 1655b4e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 16, 2011
  1. @paradoxxxzero
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 1 deletion.
  1. +2 −1  jinja2/
3  jinja2/
@@ -10,6 +10,7 @@
import re
import math
+import collections
from random import choice
from operator import itemgetter
from itertools import imap, groupby
@@ -53,7 +54,7 @@ def make_attrgetter(environment, attribute):
passed object with the rules of the environment. Dots are allowed
to access attributes of attributes.
- if '.' not in attribute:
+ if not (isinstance(attribute, collections.Iterable) and '.' in attribute):
return lambda x: environment.getitem(x, attribute)
attribute = attribute.split('.')
def attrgetter(item):
Something went wrong with that request. Please try again.