From 96af6918351564fd527b2f7d4ebebb914dd781bc Mon Sep 17 00:00:00 2001 From: Kyle Fuller Date: Mon, 30 Apr 2012 12:52:37 +0100 Subject: [PATCH 1/3] docs: It's rsync_project not rysnc_project --- docs/howto/static-files.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/howto/static-files.txt b/docs/howto/static-files.txt index e3a40a1a22..29a2c2f6e2 100644 --- a/docs/howto/static-files.txt +++ b/docs/howto/static-files.txt @@ -424,7 +424,7 @@ Here's how this might look in a fabfile:: @roles('static') def deploy_static(): local('./manage.py collectstatic') - project.rysnc_project( + project.rsync_project( remote_dir = env.remote_static_root, local_dir = env.local_static_root, delete = True From aa1aa1ad410c640ff22260b9c6bf3c36be98ff8e Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Mon, 30 Apr 2012 10:15:36 -0400 Subject: [PATCH 2/3] Fix a typo in a comment. --- django/utils/_os.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/django/utils/_os.py b/django/utils/_os.py index ad4efb3264..884689fefc 100644 --- a/django/utils/_os.py +++ b/django/utils/_os.py @@ -61,7 +61,7 @@ def rmtree_errorhandler(func, path, exc_info): continue without problems. """ exctype, value = exc_info[:2] - # lookin for a windows error + # looking for a windows error if exctype is not WindowsError or 'Access is denied' not in str(value): raise # file type should currently be read only From 4b11762f7d7aed2f4f36c4158326c0a4332038f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anssi=20K=C3=A4=C3=A4ri=C3=A4inen?= Date: Mon, 30 Apr 2012 17:12:38 +0300 Subject: [PATCH 3/3] Fixed SortedDict.__copy__() Fixed #18175 -- Calling SortedDict.__copy__() resulted in changes to the original dictionary. The reason was likely related to subclassing dict. Thanks to linovia for report and patch. --- django/utils/datastructures.py | 10 +++++++--- tests/regressiontests/utils/datastructures.py | 6 ++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/django/utils/datastructures.py b/django/utils/datastructures.py index 09d37518e0..f7042f7061 100644 --- a/django/utils/datastructures.py +++ b/django/utils/datastructures.py @@ -128,6 +128,12 @@ class SortedDict(dict): return self.__class__([(key, copy.deepcopy(value, memo)) for key, value in self.iteritems()]) + def __copy__(self): + # The Python's default copy implementation will alter the state + # of self. The reason for this seems complex but is likely related to + # subclassing dict. + return self.copy() + def __setitem__(self, key, value): if key not in self: self.keyOrder.append(key) @@ -200,9 +206,7 @@ class SortedDict(dict): def copy(self): """Returns a copy of this object.""" # This way of initializing the copy means it works for subclasses, too. - obj = self.__class__(self) - obj.keyOrder = self.keyOrder[:] - return obj + return self.__class__(self) def __repr__(self): """ diff --git a/tests/regressiontests/utils/datastructures.py b/tests/regressiontests/utils/datastructures.py index d6db991007..000f7f76a1 100644 --- a/tests/regressiontests/utils/datastructures.py +++ b/tests/regressiontests/utils/datastructures.py @@ -111,6 +111,12 @@ class SortedDictTests(SimpleTestCase): {7: 'seven', 1: 'one', 9: 'nine'} ) + def test_copy(self): + orig = SortedDict(((1, "one"), (0, "zero"), (2, "two"))) + copied = copy.copy(orig) + self.assertEqual(orig.keys(), [1, 0, 2]) + self.assertEqual(copied.keys(), [1, 0, 2]) + def test_clear(self): self.d1.clear() self.assertEqual(self.d1, {})