{{{
>>> 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.
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Comment:
I guess it's a question of how much effort it will take and if it's
possible to write tests.
--
Ticket URL: <https://code.djangoproject.com/ticket/27389#comment:1>
Comment (by Claude Paroz):
We probably need a use case also.
--
Ticket URL: <https://code.djangoproject.com/ticket/27389#comment:2>
* status: new => closed
* resolution: => wontfix
Comment:
No real use case. I was just trying to use the QueryDict in simple quick
(throwaway) python script and was surprised it didn't work standalone.
I'll resolve it as wontfix because I cannot be bothered to write a patch
;-)
--
Ticket URL: <https://code.djangoproject.com/ticket/27389#comment:3>