Opened 3 years ago
Closed 3 years ago
#33303 closed Bug (fixed)
LEVEL_TAGS not updated when using @override_settings
Reported by: | Dan Yishai | Owned by: | Hasan Ramezani |
---|---|---|---|
Component: | contrib.messages | Version: | 3.2 |
Severity: | Normal | Keywords: | |
Cc: | Claude Paroz | Triage Stage: | Ready for checkin |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
When reading messages inside tests, new message tags created using @override_settings is not updated.
That causes the django.contrib.messages.storage.base.Message.level_tag property results to be an empty string and not know the new tags.
Change History (5)
comment:1 by , 3 years ago
comment:2 by , 3 years ago
Cc: | added |
---|---|
Triage Stage: | Unreviewed → Accepted |
LEVEL_TAGS
is a constant defined in the django.contrib.messages.storage.base module
that's why it needs to be updated after changing MESSAGE_TAGS
(see #16574 and override_settings_tags() hook). It should be possible to add a setting_changed
receiver and update LEVEL_TAGS
when needed.
comment:4 by , 3 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
If you aren't planning to provide a patch (with a test), could you provide some minimal code that demonstrates the issue?