Ticket #18447: lazy.patch

File lazy.patch, 666 bytes (added by FunkyBob, 12 years ago)
  • django/utils/functional.py

    diff --git a/django/utils/functional.py b/django/utils/functional.py
    index 31466ee..dc04f4e 100644
    a b class LazyObject(object):  
    222222            self._setup()
    223223        delattr(self._wrapped, name)
    224224
     225    def __getitem__(self, name):
     226        if self._wrapped is empty:
     227            self._setup()
     228        return self._wrapped[name]
     229
     230    def __setitem__(self, name, val):
     231        if self._wrapped is empty:
     232            self._setup()
     233        self._wrapped[name] = val
     234
    225235    def _setup(self):
    226236        """
    227237        Must be implemented by subclasses to initialise the wrapped object.
Back to Top