From ea3e89cb1d32f1fc6cafa656a4d6d9863f2fefc5 Mon Sep 17 00:00:00 2001 From: Malcolm Tredinnick Date: Fri, 14 Sep 2007 09:55:17 +0000 Subject: [PATCH] Fixed a bunch of Python 2.3 issues. Two tests still fail, but this fixes the bulk of things. git-svn-id: http://code.djangoproject.com/svn/django/trunk@6183 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/contrib/localflavor/br/forms.py | 5 +++++ tests/modeltests/test_client/models.py | 2 +- tests/regressiontests/test_client_regress/models.py | 2 +- tests/runtests.py | 7 +++++++ 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/django/contrib/localflavor/br/forms.py b/django/contrib/localflavor/br/forms.py index 0f3e8e947e8..58bf7952920 100644 --- a/django/contrib/localflavor/br/forms.py +++ b/django/contrib/localflavor/br/forms.py @@ -9,6 +9,11 @@ from django.utils.encoding import smart_unicode from django.utils.translation import ugettext as _ import re +try: + set +except NameError: + from sets import Set as set # For Python 2.3 + phone_digits_re = re.compile(r'^(\d{2})[-\.]?(\d{4})[-\.]?(\d{4})$') class BRZipCodeField(RegexField): diff --git a/tests/modeltests/test_client/models.py b/tests/modeltests/test_client/models.py index 1ba86a4a417..32647552ebc 100644 --- a/tests/modeltests/test_client/models.py +++ b/tests/modeltests/test_client/models.py @@ -243,7 +243,7 @@ class ClientTest(TestCase): # Log in login = self.client.login(username='testclient', password='password') - self.assertTrue(login, 'Could not log in') + self.failUnless(login, 'Could not log in') # Request a page that requires a login response = self.client.get('/test_client/login_protected_view/') diff --git a/tests/regressiontests/test_client_regress/models.py b/tests/regressiontests/test_client_regress/models.py index c63dc2b384c..60fd909f43e 100644 --- a/tests/regressiontests/test_client_regress/models.py +++ b/tests/regressiontests/test_client_regress/models.py @@ -252,7 +252,7 @@ class LoginTests(TestCase): # Create a second client, and log in. c = Client() login = c.login(username='testclient', password='password') - self.assertTrue(login, 'Could not log in') + self.failUnless(login, 'Could not log in') # Get a redirection page with the second client. response = c.get("/test_client_regress/login_protected_redirect_view/") diff --git a/tests/runtests.py b/tests/runtests.py index 85aea501803..5635047381f 100755 --- a/tests/runtests.py +++ b/tests/runtests.py @@ -4,6 +4,13 @@ import os, sys, traceback import unittest import django.contrib as contrib + +try: + set +except NameError: + from sets import Set as set # For Python 2.3 + + CONTRIB_DIR_NAME = 'django.contrib' MODEL_TESTS_DIR_NAME = 'modeltests' REGRESSION_TESTS_DIR_NAME = 'regressiontests'