Skip to content

Fix SoftDeletableModel.delete() forwarding positional args to superclass#611

Merged
foarsitter merged 1 commit intojazzband:masterfrom
ProtixIT:delete-keep_parents
Apr 17, 2024
Merged

Fix SoftDeletableModel.delete() forwarding positional args to superclass#611
foarsitter merged 1 commit intojazzband:masterfrom
ProtixIT:delete-keep_parents

Conversation

@mthuurne
Copy link
Contributor

The soft argument was made keyword-only, to avoid conflicts with new positional arguments that might be added to Django. It was already conflicting with the keep_parents argument.

This is a backward incompatible change: code that used to pass soft positionally will require updating. Hopefully most code was either using the default (True) or was already passing soft=False as a keyword argument.

…class

The `soft` argument was made keyword-only, to avoid conflicts with new
positional arguments that might be added to Django. It was already
conflicting with the `keep_parents` argument.

The `using` argument is now passed to the superclass positionally,
as otherwise it can overlap with `*args`, resulting in a `TypeError`
on calls where `keep_parents` is passed positionally.
@mthuurne mthuurne mentioned this pull request Apr 11, 2024
@mthuurne
Copy link
Contributor Author

mthuurne commented Apr 11, 2024

Perhaps it would be safer to not forward any positional arguments to the superclass at all, and forward only keyword arguments. However, that would mean deviating from the interface that Django defines.

@foarsitter foarsitter merged commit 0693983 into jazzband:master Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants