diff --git a/django/template/defaulttags.py b/django/template/defaulttags.py index 1ebb01442e..371b57e430 100644 --- a/django/template/defaulttags.py +++ b/django/template/defaulttags.py @@ -237,7 +237,7 @@ class RegroupNode(Node): return '' output = [] # list of dictionaries in the format {'grouper': 'key', 'list': [list of contents]} for obj in obj_list: - grouper = self.expression.resolve(Context({'var': obj}), True) + grouper = self.expression.resolve(obj, True) # TODO: Is this a sensible way to determine equality? if output and repr(output[-1]['grouper']) == repr(grouper): output[-1]['list'].append(obj) @@ -847,7 +847,7 @@ def regroup(parser, token): if lastbits_reversed[1][::-1] != 'as': raise TemplateSyntaxError, "next-to-last argument to 'regroup' tag must be 'as'" - expression = parser.compile_filter('var.%s' % lastbits_reversed[2][::-1]) + expression = parser.compile_filter(lastbits_reversed[2][::-1]) var_name = lastbits_reversed[0][::-1] return RegroupNode(target, expression, var_name) diff --git a/django/test/doctest.py b/django/test/_doctest.py similarity index 99% rename from django/test/doctest.py rename to django/test/_doctest.py index 3b364f0a75..8777a2cbba 100644 --- a/django/test/doctest.py +++ b/django/test/_doctest.py @@ -1,3 +1,8 @@ +# This is a slightly modified version of the doctest.py that shipped with Python 2.4 +# It incorporates changes that have been submitted the the Python ticket tracker +# as ticket #1521051. These changes allow for a DoctestRunner and Doctest base +# class to be specified when constructing a DoctestSuite. + # Module doctest. # Released to the public domain 16-Jan-2001, by Tim Peters (tim@python.org). # Major enhancements and refactoring by: diff --git a/django/test/simple.py b/django/test/simple.py index cfaa09a0a4..5f7f86f220 100644 --- a/django/test/simple.py +++ b/django/test/simple.py @@ -1,5 +1,6 @@ -import unittest, doctest +import unittest from django.conf import settings +from django.test import _doctest as doctest from django.test.utils import setup_test_environment, teardown_test_environment from django.test.utils import create_test_db, destroy_test_db from django.test.testcases import OutputChecker, DocTestRunner diff --git a/django/test/testcases.py b/django/test/testcases.py index dd1f73befd..2bc1b5a5f8 100644 --- a/django/test/testcases.py +++ b/django/test/testcases.py @@ -1,8 +1,9 @@ -import re, doctest, unittest +import re, unittest from urlparse import urlparse from django.db import transaction from django.core import management, mail from django.db.models import get_apps +from django.test import _doctest as doctest from django.test.client import Client normalize_long_ints = lambda s: re.sub(r'(?