Skip to content

use warnings rather than logging a warning for DecimalField warnings #9367

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged

Conversation

terencehonles
Copy link
Contributor

Description

addressing #8972 (comment)

@auvipy auvipy added the Cleanup label Apr 27, 2024
@auvipy auvipy merged commit e596f43 into encode:master Apr 27, 2024
9 checks passed
@terencehonles terencehonles deleted the use-warnings-rather-than-logging branch May 7, 2024 12:03
@tomchristie tomchristie mentioned this pull request Jun 14, 2024
if self.min_value is not None and not isinstance(self.min_value, decimal.Decimal):
logger.warning("min_value in DecimalField should be Decimal type.")
warnings.warn("min_value should be a Decimal instance.")
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add a stacklevel param so that python displays a trace with the faulty calling code rather than this line?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants