Skip to main content

SessionMixin

Expands a basic dictionary with session attributes.

Attributes

AttributeTypeDescription
new= FalseSome implementations can detect whether a session is newly created, but that is not guaranteed. Use with caution. The mixin default is hard-coded "False".
modified= TrueSome implementations can detect changes to the session and set this when that happens. The mixin default is hard coded to "True".
accessed= FalseIndicates if the session was accessed, even if it was not modified. This is set when the session object is accessed through the request context, including the global :data:.session proxy. A Vary: cookie header will be added if this is True.

Methods


permanent()

@classmethod
def permanent() - > bool

This reflects the "_permanent" key in the dict.

Returns

TypeDescription
boolThe boolean value indicating if the session is permanent.

permanent()

@classmethod
def permanent(
value: bool
) - > None

Sets the permanent status of the session by updating the "_permanent" key in the dictionary.

Parameters

NameTypeDescription
valueboolA boolean indicating whether the session should be permanent. This value is cast to a boolean.

Returns

TypeDescription
NoneNone