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 Tim Graham, 3 years ago

If you aren't planning to provide a patch (with a test), could you provide some minimal code that demonstrates the issue?

comment:2 by Mariusz Felisiak, 3 years ago

Cc: Claude Paroz added
Triage Stage: UnreviewedAccepted

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:3 by Hasan Ramezani, 3 years ago

Has patch: set
Owner: changed from nobody to Hasan Ramezani
Status: newassigned

comment:4 by Mariusz Felisiak, 3 years ago

Triage Stage: AcceptedReady for checkin

comment:5 by Mariusz Felisiak <felisiak.mariusz@…>, 3 years ago

Resolution: fixed
Status: assignedclosed

In 24b31653:

Fixed #33303 -- Changed messages' level tags on MESSAGE_TAGS setting change.

Note: See TracTickets for help on using tickets.
Back to Top