django.conf.settings doesn't work if setattr is used before getattr
|Reported by:||Noam Raphael <spam.noam@…>||Owned by:||jacob|
|Cc:||Triage Stage:||Ready for checkin|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
If you set DJANGO_SETTINGS_MODULE manually, and then do
from django.conf import settings settings.DATABASE_NAME = 'hello'
You get an exception.
It turns out that LazySettings initializes _target only on getattr, and not on setattr.
The attached two-line patch initializes it also on setattr.
(I really encountered this bug!)
Change History (4)
Changed 9 years ago by Noam Raphael <spam.noam@…>
comment:1 Changed 9 years ago by Simon G. <dev@…>
- Has patch set
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- Triage Stage changed from Unreviewed to Ready for checkin
comment:2 Changed 9 years ago by mtredinnick
- Resolution set to fixed
- Status changed from new to closed