From 53b04361026afb1874a107134f5384c3a4936c03 Mon Sep 17 00:00:00 2001 From: Gary Wilson Jr Date: Fri, 29 May 2009 05:28:40 +0000 Subject: [PATCH] [1.0.X] Fixed a few Python 2.3 incompatibilities that were causing test failures. Backport of [10863] from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.0.X@10864 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/forms/models.py | 2 +- tests/regressiontests/file_storage/tests.py | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/django/forms/models.py b/django/forms/models.py index 057b2c50ae..528a60c181 100644 --- a/django/forms/models.py +++ b/django/forms/models.py @@ -577,7 +577,7 @@ class BaseModelFormSet(BaseFormSet): else: return ugettext("Please correct the duplicate data for %(field)s, " "which must be unique.") % { - "field": get_text_list(unique_check, _("and")), + "field": get_text_list(unique_check, unicode(_("and"))), } def get_date_error_message(self, date_check): diff --git a/tests/regressiontests/file_storage/tests.py b/tests/regressiontests/file_storage/tests.py index 6e2b7be8e7..c228764e06 100644 --- a/tests/regressiontests/file_storage/tests.py +++ b/tests/regressiontests/file_storage/tests.py @@ -161,9 +161,9 @@ class FileStoragePathParsing(TestCase): self.storage.save('dotted.path/test', ContentFile("1")) self.storage.save('dotted.path/test', ContentFile("2")) - self.assertFalse(os.path.exists(os.path.join(self.storage_dir, 'dotted_.path'))) - self.assertTrue(os.path.exists(os.path.join(self.storage_dir, 'dotted.path/test'))) - self.assertTrue(os.path.exists(os.path.join(self.storage_dir, 'dotted.path/test_'))) + self.failIf(os.path.exists(os.path.join(self.storage_dir, 'dotted_.path'))) + self.assert_(os.path.exists(os.path.join(self.storage_dir, 'dotted.path/test'))) + self.assert_(os.path.exists(os.path.join(self.storage_dir, 'dotted.path/test_'))) def test_first_character_dot(self): """ @@ -173,13 +173,13 @@ class FileStoragePathParsing(TestCase): self.storage.save('dotted.path/.test', ContentFile("1")) self.storage.save('dotted.path/.test', ContentFile("2")) - self.assertTrue(os.path.exists(os.path.join(self.storage_dir, 'dotted.path/.test'))) + self.assert_(os.path.exists(os.path.join(self.storage_dir, 'dotted.path/.test'))) # Before 2.6, a leading dot was treated as an extension, and so # underscore gets added to beginning instead of end. if sys.version_info < (2, 6): - self.assertTrue(os.path.exists(os.path.join(self.storage_dir, 'dotted.path/_.test'))) + self.assert_(os.path.exists(os.path.join(self.storage_dir, 'dotted.path/_.test'))) else: - self.assertTrue(os.path.exists(os.path.join(self.storage_dir, 'dotted.path/.test_'))) + self.assert_(os.path.exists(os.path.join(self.storage_dir, 'dotted.path/.test_'))) if Image is not None: class DimensionClosingBug(TestCase):