=== To replicate this bug ===
{{{
>>> from django.conf import settings
>>> settings.configure() # Just to allow the following import
>>> from django.contrib.messages.storage.base import Message
>>> from django.contrib.messages.storage.cookie import MessageEncoder,
MessageDecoder
>>> original_message = Message(10, "Here is a message", extra_tags="")
>>> encoded_message = MessageEncoder().encode(original_message)
>>> decoded_message = MessageDecoder().decode(encoded_message)
>>> original_message.extra_tags == ""
True
>>> decoded_message.extra_tags is None
True
}}}
=== Effect of the bug in application behaviour ===
This error occurred in the wild with a template tag similar to the
following:
{{{
{% if x not in message.extra_tags %}
}}}
When the message was displayed as part of a redirect, it had been
serialised and deserialized which meant that extra_tags was `None` instead
of the empty string. This caused an error.
It's important to note that this bug affects all of the standard API
(`messages.debug`, `messages.info` etc. all have a default value of
`extra_tags` equal to `""`).
--
Ticket URL: <https://code.djangoproject.com/ticket/33458>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* owner: nobody => Tim McCurrach
* status: new => assigned
* has_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/33458#comment:1>
* stage: Unreviewed => Accepted
Comment:
Thanks for the report.
--
Ticket URL: <https://code.djangoproject.com/ticket/33458#comment:2>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/33458#comment:3>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"efb4478e484ae61c5fc23563d4e9df1f8f49df49" efb4478]:
{{{
#!CommitTicketReference repository=""
revision="efb4478e484ae61c5fc23563d4e9df1f8f49df49"
Fixed #33458 -- Fixed encoding of messages with empty string as
extra_tags.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/33458#comment:4>