From: Armin Ronacher Date: Tue, 10 Jul 2007 17:49:35 +0000 (+0200) Subject: [svn] groupby sorts on it's own now X-Git-Tag: 2.0rc1~284 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=89606ccdcdf2922bb40b49565db8fd8751c6eefc;p=jinja2.git [svn] groupby sorts on it's own now --HG-- branch : trunk --- diff --git a/jinja/filters.py b/jinja/filters.py index f253d37..6e74164 100644 --- a/jinja/filters.py +++ b/jinja/filters.py @@ -877,10 +877,12 @@ def do_groupby(attribute): """ def wrapped(env, context, value): expr = lambda x: env.get_attribute(x, attribute) - return [{ + rv = [{ 'grouper': a, 'list': list(b) } for a, b in groupby(sorted(value, key=expr), expr)] + rv.sort() + return rv return wrapped