Merge branch 'master' of github.com:django/django
This commit is contained in:
commit
3d842a0a94
|
@ -61,7 +61,7 @@ def rmtree_errorhandler(func, path, exc_info):
|
||||||
continue without problems.
|
continue without problems.
|
||||||
"""
|
"""
|
||||||
exctype, value = exc_info[:2]
|
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):
|
if exctype is not WindowsError or 'Access is denied' not in str(value):
|
||||||
raise
|
raise
|
||||||
# file type should currently be read only
|
# file type should currently be read only
|
||||||
|
|
|
@ -128,6 +128,12 @@ class SortedDict(dict):
|
||||||
return self.__class__([(key, copy.deepcopy(value, memo))
|
return self.__class__([(key, copy.deepcopy(value, memo))
|
||||||
for key, value in self.iteritems()])
|
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):
|
def __setitem__(self, key, value):
|
||||||
if key not in self:
|
if key not in self:
|
||||||
self.keyOrder.append(key)
|
self.keyOrder.append(key)
|
||||||
|
@ -200,9 +206,7 @@ class SortedDict(dict):
|
||||||
def copy(self):
|
def copy(self):
|
||||||
"""Returns a copy of this object."""
|
"""Returns a copy of this object."""
|
||||||
# This way of initializing the copy means it works for subclasses, too.
|
# This way of initializing the copy means it works for subclasses, too.
|
||||||
obj = self.__class__(self)
|
return self.__class__(self)
|
||||||
obj.keyOrder = self.keyOrder[:]
|
|
||||||
return obj
|
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -424,7 +424,7 @@ Here's how this might look in a fabfile::
|
||||||
@roles('static')
|
@roles('static')
|
||||||
def deploy_static():
|
def deploy_static():
|
||||||
local('./manage.py collectstatic')
|
local('./manage.py collectstatic')
|
||||||
project.rysnc_project(
|
project.rsync_project(
|
||||||
remote_dir = env.remote_static_root,
|
remote_dir = env.remote_static_root,
|
||||||
local_dir = env.local_static_root,
|
local_dir = env.local_static_root,
|
||||||
delete = True
|
delete = True
|
||||||
|
|
|
@ -111,6 +111,12 @@ class SortedDictTests(SimpleTestCase):
|
||||||
{7: 'seven', 1: 'one', 9: 'nine'}
|
{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):
|
def test_clear(self):
|
||||||
self.d1.clear()
|
self.d1.clear()
|
||||||
self.assertEqual(self.d1, {})
|
self.assertEqual(self.d1, {})
|
||||||
|
|
Loading…
Reference in New Issue