mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #18447 -- Made LazyObject unwrap on dict access.
Thanks Roman Gladkov and Zbigniew Siciarz.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user