--
Ticket URL: <https://code.djangoproject.com/ticket/30677>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* has_patch: 0 => 1
Old description:
> I am upgrading to 2.2.1 from 2.0.5 and my tests are failing due to a
> change in the test client:
> https://docs.djangoproject.com/en/2.2/releases/2.2/#miscellaneous. It now
> throws an exception if a None value is provided in data given to a POST.
> I would like to propose an improvement to the message to display the
> offending Key and Value that generate the exception.
New description:
I am upgrading to 2.2.1 from 2.0.5 and my tests are failing due to a
change in the test client:
https://docs.djangoproject.com/en/2.2/releases/2.2/#miscellaneous. It now
throws an exception if a None value is provided in data given to a POST. I
would like to propose an improvement to the message to display the
offending Key and Value that generate the exception.
I have a proposed change in my fork on github:
https://github.com/idahogray/django/tree/ticket_30677
--
--
Ticket URL: <https://code.djangoproject.com/ticket/30677#comment:1>
* stage: Unreviewed => Accepted
Comment:
I like your suggestion. I would suggest a slightly different wording:
{{{#!python
raise TypeError(
"Cannot encode None for key '%s' as POST data. Did you
mean "
"to pass an empty string or omit the value?" % key
)
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/30677#comment:2>
* has_patch: 1 => 0
* version: 2.2 => master
Comment:
I agree with Markus' suggestion. Can you create PR via GitHub?
--
Ticket URL: <https://code.djangoproject.com/ticket/30677#comment:3>
Comment (by Keith Gray):
I will change the wording and create a PR. I have one more question, can I
use f-strings since this is going into master? I cloned the repo and tried
to run the tests in a Python 3.5 environment but it wouldn't let me.
--
Ticket URL: <https://code.djangoproject.com/ticket/30677#comment:4>
Comment (by felixxm):
Django 3.0 supports Python 3.6+, nevertheless please don't use f-strings
(see #29988).
--
Ticket URL: <https://code.djangoproject.com/ticket/30677#comment:5>
* easy: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/30677#comment:6>
* status: new => assigned
* owner: nobody => Swatantra
--
Ticket URL: <https://code.djangoproject.com/ticket/30677#comment:7>
* needs_better_patch: 0 => 1
* has_patch: 0 => 1
Comment:
[https://github.com/django/django/pull/11638 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/30677#comment:8>
* needs_better_patch: 1 => 0
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/30677#comment:9>
Comment (by Keith Gray):
Sorry for the delayed response, i was traveling this week. Thanks for
picking this up.
--
Ticket URL: <https://code.djangoproject.com/ticket/30677#comment:10>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"73ac9e3f04c4a1a6b1add05c207d11c8ff461b7d" 73ac9e3]:
{{{
#!CommitTicketReference repository=""
revision="73ac9e3f04c4a1a6b1add05c207d11c8ff461b7d"
Fixed #30677 -- Improved error message for urlencode() and Client when
None is passed as data.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/30677#comment:11>