#31165: Overhaul settings
----------------------------------------+--------------------------
               Reporter:  orlnub123     |          Owner:  nobody
                   Type:  Bug           |         Status:  new
              Component:  Core (Other)  |        Version:  master
               Severity:  Normal        |       Keywords:  settings
           Triage Stage:  Unreviewed    |      Has patch:  1
    Needs documentation:  0             |    Needs tests:  0
Patch needs improvement:  0             |  Easy pickings:  0
                  UI/UX:  0             |
----------------------------------------+--------------------------
 This overhaul fixes a couple of bugs and makes the code simpler. The bugs
 it
 fixes are:

 - Being able to set non-upper attributes directly on the settings object
 e.g.:
   {{{#!python
   from django.conf import settings

   settings.foo = 'bar'  # Doesn't error
   print(settings.foo)
   }}}

 - Being able to delete the same setting multiple times on user configured
 settings e.g.:
   {{{#!python
   from django.conf import settings

   settings.configure()
   # Doesn't error
   del settings.TEST
   del settings.TEST
   del settings.TEST
   }}}

 - `Settings.is_overridden` ignoring set and deleted settings directly on
 the settings object e.g.:
   {{{#!python
   from django.conf import settings

   assert settings.is_overridden('TEST')
   del settings.TEST
   print(settings.is_overridden('TEST'))  # True; should be False

   assert not settings.is_overridden('TEST2')
   settings.TEST2 = 2
   print(settings.is_overridden('TEST2'))  # False; should be True
   }}}

 The biggest change is that now user configured settings are evaluated
 immediately instead of on-demand via a `__getattr__`. This was done to fix
 the second bug in the simplest way. If all settings live in the
 `__dict__`, you don't have to fake attribute deletion.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/31165>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/052.cbedbdec56b760a304a2b7c69eb4e08e%40djangoproject.com.

Reply via email to