summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2013-03-18 11:09:29 +0100
committerAymeric Augustin <aymeric.augustin@m4x.org>2013-03-18 11:10:19 +0100
commit0efafa4c54ab8ad684df66c8e34928bb2ba88656 (patch)
tree53bf69255fceef5031815e392da1764d81e51444 /django
parent7cf0f04230b1b6dd2680548338fe584c0ad3f85a (diff)
Fixed #18447 -- Made LazyObject unwrap on dict access.
Thanks Roman Gladkov and Zbigniew Siciarz.
Diffstat (limited to 'django')
-rw-r--r--django/utils/functional.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/django/utils/functional.py b/django/utils/functional.py
index d740acf8f2..f19a46aa3a 100644
--- a/django/utils/functional.py
+++ b/django/utils/functional.py
@@ -249,9 +249,22 @@ class LazyObject(object):
"""
raise NotImplementedError
- # introspection support:
+ # Introspection support
__dir__ = new_method_proxy(dir)
+ # Dictionary methods support
+ @new_method_proxy
+ def __getitem__(self, key):
+ return self[key]
+
+ @new_method_proxy
+ def __setitem__(self, key, value):
+ self[key] = value
+
+ @new_method_proxy
+ def __delitem__(self, key):
+ del self[key]
+
# Workaround for http://bugs.python.org/issue12370
_super = super