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:
Jacob Kaplan-Moss 2009-12-12 17:51:51 +00:00
parent f761802b22
commit ac8da7b36f
4 changed files with 24 additions and 0 deletions

View file

@ -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.