#30178: Support duck-typing for database passwords in settings
-------------------------------------+-------------------------------------
     Reporter:  Dan Davis            |                    Owner:  Dan Davis
         Type:  Bug                  |                   Status:  assigned
    Component:  Database layer       |                  Version:  2.1
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:  oracle               |             Triage Stage:
                                     |  Unreviewed
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Adam (Chainz) Johnson):

 This isn't necessary. Instead of having a duck-typed object to replace the
 password string, you can use a duck-typed `dict` for the settings in
 `DATABASES`, something like:

 {{{
 class mydict(dict):
     def __getitem__(self, key):
         if key == 'PASSWORD':
             return get_the_password()
         return super().__getitem__(key)

 DATABASES = {'default': mydict(USER='foo')}
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/30178#comment:7>
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.d4df21ad01f58b6ab3c87aa175ecbcba%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to