From a0c6d992efbefe931b169872ce48f3668c861f36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Raskovsky?= Date: Mon, 18 Jul 2011 15:21:57 -0300 Subject: [PATCH] added python 2.5 compatibility to google_analytics --- analytical/templatetags/google_analytics.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/analytical/templatetags/google_analytics.py b/analytical/templatetags/google_analytics.py index 3aced7c..8c76fa5 100644 --- a/analytical/templatetags/google_analytics.py +++ b/analytical/templatetags/google_analytics.py @@ -36,6 +36,15 @@ CUSTOM_VAR_CODE = "_gaq.push(['_setCustomVar', %(index)s, '%(name)s', " \ register = Library() +def enumerate(sequence, start=0): + """ + Port of 2.6's python enumerate() for compatibility with previos versions + """ + n = start + for elem in sequence: + yield n, elem + n += 1 + @register.tag def google_analytics(parser, token):