[Django] #33303: LEVEL_TAGS not updated when using @override_settings

16 views
Skip to first unread message

Django

unread,
Nov 19, 2021, 12:29:29 PM11/19/21
to django-...@googlegroups.com
#33303: LEVEL_TAGS not updated when using @override_settings
--------------------------------------------+------------------------
Reporter: Dan Yishai | Owner: nobody
Type: Bug | Status: new
Component: contrib.messages | Version: 3.2
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
--------------------------------------------+------------------------
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.

--
Ticket URL: <https://code.djangoproject.com/ticket/33303>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Nov 19, 2021, 1:46:12 PM11/19/21
to django-...@googlegroups.com
#33303: LEVEL_TAGS not updated when using @override_settings
----------------------------------+--------------------------------------

Reporter: Dan Yishai | Owner: nobody
Type: Bug | Status: new
Component: contrib.messages | Version: 3.2
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------+--------------------------------------

Comment (by Tim Graham):

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

--
Ticket URL: <https://code.djangoproject.com/ticket/33303#comment:1>

Django

unread,
Nov 22, 2021, 12:35:24 AM11/22/21
to django-...@googlegroups.com
#33303: LEVEL_TAGS not updated when using @override_settings
----------------------------------+------------------------------------

Reporter: Dan Yishai | Owner: nobody
Type: Bug | Status: new
Component: contrib.messages | Version: 3.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------+------------------------------------
Changes (by Mariusz Felisiak):

* cc: Claude Paroz (added)
* stage: Unreviewed => Accepted


Comment:

`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
[https://github.com/django/django/blob/a7e7043c8746933dafce652507d3b821801cdc7d/tests/messages_tests/base.py#L25-L36
override_settings_tags()] hook). It should be possible to add a
`setting_changed` receiver and update `LEVEL_TAGS` when needed.

--
Ticket URL: <https://code.djangoproject.com/ticket/33303#comment:2>

Django

unread,
Nov 25, 2021, 8:28:56 AM11/25/21
to django-...@googlegroups.com
#33303: LEVEL_TAGS not updated when using @override_settings
-------------------------------------+-------------------------------------
Reporter: Dan Yishai | Owner: Hasan
| Ramezani
Type: Bug | Status: assigned
Component: contrib.messages | Version: 3.2

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Hasan Ramezani):

* owner: nobody => Hasan Ramezani
* status: new => assigned
* has_patch: 0 => 1


Comment:

[https://github.com/django/django/pull/15127 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/33303#comment:3>

Django

unread,
Nov 26, 2021, 1:03:31 AM11/26/21
to django-...@googlegroups.com
#33303: LEVEL_TAGS not updated when using @override_settings
-------------------------------------+-------------------------------------
Reporter: Dan Yishai | Owner: Hasan
| Ramezani
Type: Bug | Status: assigned
Component: contrib.messages | Version: 3.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/33303#comment:4>

Django

unread,
Nov 26, 2021, 2:10:14 AM11/26/21
to django-...@googlegroups.com
#33303: LEVEL_TAGS not updated when using @override_settings
-------------------------------------+-------------------------------------
Reporter: Dan Yishai | Owner: Hasan
| Ramezani
Type: Bug | Status: closed
Component: contrib.messages | Version: 3.2
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak <felisiak.mariusz@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"24b316536a7ee4c54a54f632de1852aecb4038c0" 24b31653]:
{{{
#!CommitTicketReference repository=""
revision="24b316536a7ee4c54a54f632de1852aecb4038c0"
Fixed #33303 -- Changed messages' level tags on MESSAGE_TAGS setting
change.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/33303#comment:5>

Reply all
Reply to author
Forward
0 new messages