mirror of
https://github.com/django/django.git
synced 2025-10-24 22:26:08 +00:00
Fixed #5487 -- Added deepcopying ability to lazy() objects, along with a test to demonstrate why the previous code failed. Debugging and patch from John Buchanan.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6276 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import copy
|
||||
|
||||
def curry(_curried_func, *args, **kwargs):
|
||||
def _curried(*moreargs, **morekwargs):
|
||||
return _curried_func(*(args+moreargs), **dict(kwargs, **morekwargs))
|
||||
@@ -101,6 +103,11 @@ def lazy(func, *resultclasses):
|
||||
else:
|
||||
raise AssertionError('__mod__ not supported for non-string types')
|
||||
|
||||
def __deepcopy__(self, memo):
|
||||
result = copy.copy(self)
|
||||
memo[id(self)] = result
|
||||
return result
|
||||
|
||||
def __wrapper__(*args, **kw):
|
||||
# Creates the proxy object, instead of the actual value.
|
||||
return __proxy__(args, kw)
|
||||
|
||||
Reference in New Issue
Block a user