Skip to content

Conversation

@michael-k
Copy link
Contributor

Description

This prevents exceptions when the error message contains %, but is not intended for formatting (more details are available in the linked issue). Django itself does the same: https://github.com/django/django/blob/6866c91b638de5368c18713fa851bfe56253ea55/django/core/exceptions.py#L168-L169

refs #6622

This prevents exceptions when the error message contains `%`, but is
not intended for formatting.  Django itself does the same:
https://github.com/django/django/blob/6866c91b638de5368c18713fa851bfe56253ea55/django/core/exceptions.py#L168-L169

Fixes encode#6622
err = DjangoValidationError('exc_msg', code='exc_code')
err = DjangoValidationError(
'exc_msg %s', code='exc_code', params=('exc_param',),
)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not related to the issue, but there was no test that actually used params.

@bluetech
Copy link
Contributor

bluetech commented May 3, 2019

This looks good to me. The test would demonstrate my comment here: #6545 (comment)

@rpkilby
Copy link
Contributor

rpkilby commented May 6, 2019

Adding to the milestone. I'd like to consider this in coordination with #6545/#6644.

@rpkilby rpkilby added this to the 3.10 Release milestone May 6, 2019
@lovelydinosaur
Copy link
Contributor

Yup, good stuff. 👍

@lovelydinosaur lovelydinosaur merged commit 79b2350 into encode:master Jul 1, 2019
@michael-k michael-k deleted the format-error-message branch July 1, 2019 15:25
pchiquet pushed a commit to pchiquet/django-rest-framework that referenced this pull request Nov 17, 2020
This prevents exceptions when the error message contains `%`, but is
not intended for formatting.  Django itself does the same:
https://github.com/django/django/blob/6866c91b638de5368c18713fa851bfe56253ea55/django/core/exceptions.py#L168-L169

Fixes encode#6622
sigvef pushed a commit to sigvef/django-rest-framework that referenced this pull request Dec 3, 2022
This prevents exceptions when the error message contains `%`, but is
not intended for formatting.  Django itself does the same:
https://github.com/django/django/blob/6866c91b638de5368c18713fa851bfe56253ea55/django/core/exceptions.py#L168-L169

Fixes encode#6622
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.

4 participants