From c1a8bd6779c2ff907d2d80b98d79c8ab10d642ae Mon Sep 17 00:00:00 2001 From: Jacob Kaplan-Moss Date: Sat, 12 Dec 2009 17:53:32 +0000 Subject: [1.1.X] Fixed #10130: you may now delete attributes on `settings`. Thanks, jcassee. Backport of r11824. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@11825 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/utils/functional.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'django/utils') diff --git a/django/utils/functional.py b/django/utils/functional.py index 65a9b9d7aa..e6dbeb32e0 100644 --- a/django/utils/functional.py +++ b/django/utils/functional.py @@ -280,6 +280,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. -- cgit v1.3