diff options
| author | Luke Plant <L.Plant.98@cantab.net> | 2010-01-05 13:20:19 +0000 |
|---|---|---|
| committer | Luke Plant <L.Plant.98@cantab.net> | 2010-01-05 13:20:19 +0000 |
| commit | 3de16688a93d64154dea1f5517d3e9e80b97b080 (patch) | |
| tree | cd328ad314bd3578e238a967f603a660e5b096fb /django/utils/functional.py | |
| parent | d4f9bff7ef190fdaedaa5319718f1db265d86d56 (diff) | |
[1.1.X] Fixed #12506 - 'lazy' fails when there are multiple expected classes with the same method
Thanks to Alex for report and patch
Backport of r12104 from trunk.
git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@12105 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/utils/functional.py')
| -rw-r--r-- | django/utils/functional.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/django/utils/functional.py b/django/utils/functional.py index 2d11ac9cf5..35c994538e 100644 --- a/django/utils/functional.py +++ b/django/utils/functional.py @@ -167,9 +167,13 @@ def lazy(func, *resultclasses): for resultclass in resultclasses: cls.__dispatch[resultclass] = {} for (k, v) in resultclass.__dict__.items(): + # All __promise__ return the same wrapper method, but they + # also do setup, inserting the method into the dispatch + # dict. + meth = cls.__promise__(resultclass, k, v) if hasattr(cls, k): continue - setattr(cls, k, cls.__promise__(resultclass, k, v)) + setattr(cls, k, meth) cls._delegate_str = str in resultclasses cls._delegate_unicode = unicode in resultclasses assert not (cls._delegate_str and cls._delegate_unicode), "Cannot call lazy() with both str and unicode return types." |
