#27389: Cannot use QueryDict without configuring settings first
--------------------------------------+--------------------
     Reporter:  Jaap Roes             |      Owner:  nobody
         Type:  Cleanup/optimization  |     Status:  new
    Component:  HTTP handling         |    Version:  master
     Severity:  Normal                |   Keywords:
 Triage Stage:  Unreviewed            |  Has patch:  0
Easy pickings:  0                     |      UI/UX:  0
--------------------------------------+--------------------
 This is not really a bug, but I was surprised by this behaviour:

 {{{
 >>> from django.http import QueryDict
 >>> q = QueryDict('a=1&a=2&b=3&c=4&c=5&d')
 Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "/path/to/lib/python3.4/site-packages/django/http/request.py", line
 377, in __init__
     encoding = settings.DEFAULT_CHARSET
   File "/path/to/lib/python3.4/site-packages/django/conf/__init__.py",
 line 53, in __getattr__
     self._setup(name)
   File "/path/to/lib/python3.4/site-packages/django/conf/__init__.py",
 line 39, in _setup
     % (desc, ENVIRONMENT_VARIABLE))
 django.core.exceptions.ImproperlyConfigured: Requested setting
 DEFAULT_CHARSET, but settings are not configured. You must either define
 the environment variable DJANGO_SETTINGS_MODULE or call
 settings.configure() before accessing settings.
 }}}

 The `QueryDict` implementation relies on two Django settings
 `DEFAULT_CHARSET` and `DATA_UPLOAD_MAX_NUMBER_FIELDS`, both have sane
 defaults (`'utf-8'` and `1000`) and are probably rarely overruled in user
 settings. Would it be acceptable to just use these values if settings
 aren't configured?

--
Ticket URL: <https://code.djangoproject.com/ticket/27389>
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/048.c777e5dec8b8ff8d64a57b7099647b47%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to