mirror of
https://github.com/django/django.git
synced 2025-09-18 00:10:22 +00:00
FIxed #10130: you may now delete attributes on settings
. Thanks, jcassee.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11824 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
f761802b22
commit
ac8da7b36f
4 changed files with 24 additions and 0 deletions
|
@ -277,6 +277,13 @@ class LazyObject(object):
|
|||
self._setup()
|
||||
setattr(self._wrapped, name, value)
|
||||
|
||||
def __delattr__(self, name):
|
||||
if name == "_wrapped":
|
||||
raise TypeError("can't delete _wrapped.")
|
||||
if self._wrapped is None:
|
||||
self._setup()
|
||||
delattr(self._wrapped, name)
|
||||
|
||||
def _setup(self):
|
||||
"""
|
||||
Must be implemented by subclasses to initialise the wrapped object.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue