Skip to main content

CookieStorage

Store messages in a cookie.

Attributes

AttributeTypeDescription
cookie_namestring = "messages"The name of the HTTP cookie used to store the serialized message data.
max_cookie_sizeinteger = 2048The maximum allowed size in bytes for the session cookie to ensure it fits within HTTP header limits.
not_finishedstring = "messagesnotfinished"A sentinel string value appended to the message list to indicate that not all messages could be stored due to size constraints.
not_finished_jsonstring = json.dumps("messagesnotfinished")The JSON-encoded version of the not_finished sentinel value used during the serialization process.
key_saltstring = "django.contrib.messages"The salt value used by the signer to provide cryptographic protection for the cookie data.

Constructor

Signature

def CookieStorage(
*args: any,
**kwargs: any
)

Parameters

NameTypeDescription
*argsanyVariable length argument list passed to the base storage constructor.
**kwargsanyArbitrary keyword arguments passed to the base storage constructor.