{{{
TypeError: 'x' is an invalid keyword argument for this function
}}}
It takes a couple of seconds to notice what "this function" refers to,
especially if the call is behind some abstraction like factory_boy. You
have to scroll several levels up the stack trace to notice the offender. I
propose to change this message to:
{{{
TypeError: 'x' is an invalid keyword argument for ModelName
}}}
I can submit a pull request once the ticket is accepted.
--
Ticket URL: <https://code.djangoproject.com/ticket/29516>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Comment (by Federico Bond):
Perhaps even better would be to imitate the default error message in
Python:
{{{
ModelName() got an unexpected keyword argument 'x'
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/29516#comment:1>
* owner: (none) => nobody
* type: Uncategorized => Cleanup/optimization
* stage: Unreviewed => Accepted
* component: Error reporting => Database layer (models, ORM)
--
Ticket URL: <https://code.djangoproject.com/ticket/29516#comment:2>
* status: new => assigned
* owner: nobody => Federico Bond
--
Ticket URL: <https://code.djangoproject.com/ticket/29516#comment:3>
* has_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/29516#comment:4>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"4c36414323d9035a93a2b7a54ff5281116950fe1" 4c36414]:
Fixed #29517 -- Rephrased error message when passing incorrect kwarg to
model constructor
--
Ticket URL: <https://code.djangoproject.com/ticket/29516#comment:5>
Comment (by Tim Graham <timograham@…>):
In [changeset:"e7185a6514ee83802f07ca1f6d2dff615b8fdfed" e7185a6]:
{{{
#!CommitTicketReference repository=""
revision="e7185a6514ee83802f07ca1f6d2dff615b8fdfed"
Refs #29516 -- Reverted inadvertent change in Model.__init__().
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/29516#comment:6>