#28406: bug with HStore that has a default value of empty dict - {}
-------------------------------------+-------------------------------------
     Reporter:  Eyal Elkevity        |                    Owner:  nobody
         Type:  Bug                  |                   Status:  closed
    Component:  Database layer       |                  Version:  1.11
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:  invalid
     Keywords:  hstore               |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Craig de Stigter):

 I just got bit by this and it took several hours to track down what was
 wrong.  Some thoughts:

 * Seems the docs should say "shouldn't" here rather than "can't", since
 HStoreField happily accepts a mutable default value.
 * There should be a load-time check for this. It's an easy mistake to
 make, and very confusing / hard to track down.
 * In fact, why doesn't the field reject `default={}` outright? Not every
 mutable value is obvious, but dict instances are probably 99% of them, so
 it could check for those.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/28406#comment:2>
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.8bc84452390f20865e243bbf1c7eacf1%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to