Skip to main content

SessionMixin

Expands a basic dictionary with session attributes.

Attributes

AttributeTypeDescription
newbool = FalseSome implementations can detect whether a session is newly created, but that is not guaranteed.
modifiedbool = TrueSome implementations can detect changes to the session and set this when that happens.
accessedbool = FalseIndicates if the session was accessed, even if it was not modified, and triggers the addition of a Vary: cookie header if True.

Methods


permanent()

@classmethod
def permanent() - > bool

This reflects the '_permanent' key in the dict.

Returns

TypeDescription
boolTrue if the session is marked as permanent, otherwise False

permanent()

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

Sets the permanent status of the session by updating the internal '_permanent' key.

Parameters

NameTypeDescription
valueboolA boolean flag indicating whether the session should persist across browser restarts

Returns

TypeDescription
Nonenull