class documentation

class BaseStorage:

Known subclasses: django.contrib.messages.storage.cookie.CookieStorage, django.contrib.messages.storage.fallback.FallbackStorage, django.contrib.messages.storage.session.SessionStorage

View In Hierarchy

This is the base backend for temporary message storage.

This is not a complete class; to be a usable storage backend, it must be subclassed and the two methods _get and _store overridden.

Method __contains__ Undocumented
Method __init__ Undocumented
Method __iter__ Undocumented
Method __len__ Undocumented
Method __repr__ Undocumented
Method ​_get No summary
Method ​_get​_level Return the minimum recorded level.
Method ​_prepare​_messages Prepare a list of messages for storage.
Method ​_set​_level Set a custom minimum recorded level.
Method ​_store Store a list of messages and return a list of any messages which could not be stored.
Method add Queue a message to be stored.
Method update Store all unread messages.
Class Variable level Undocumented
Instance Variable ​_level Undocumented
Instance Variable ​_queued​_messages Undocumented
Instance Variable added​_new Undocumented
Instance Variable request Undocumented
Instance Variable used Undocumented
Property ​_loaded​_messages Return a list of loaded messages, retrieving them first if they have not been loaded yet.
def __contains__(self, item):

Undocumented

def __iter__(self):

Undocumented

def __len__(self):

Undocumented

def __repr__(self):

Undocumented

def _get(self, *args, **kwargs):

Retrieve a list of stored messages. Return a tuple of the messages and a flag indicating whether or not all the messages originally intended to be stored in this storage were, in fact, stored and retrieved; e.g., (messages, all_retrieved).

This method must be implemented by a subclass.

If it is possible to tell if the backend was not used (as opposed to just containing no messages) then None should be returned in place of messages.

def _get_level(self):

Return the minimum recorded level.

The default level is the MESSAGE_LEVEL setting. If this is not found, the INFO level is used.

def _prepare_messages(self, messages):
Prepare a list of messages for storage.
def _set_level(self, value=None):

Set a custom minimum recorded level.

If set to None, the default level will be used (see the _get_level method).

def _store(self, messages, response, *args, **kwargs):

Store a list of messages and return a list of any messages which could not be stored.

One type of object must be able to be stored, Message.

This method must be implemented by a subclass.

def add(self, level, message, extra_tags=''):

Queue a message to be stored.

The message is only queued if it contained something and its level is not less than the recording level (self.level).

def update(self, response):

Store all unread messages.

If the backend has yet to be iterated, store previously stored messages again. Otherwise, only store messages added after the last iteration.

level =

Undocumented

_level =

Undocumented

_queued_messages: list =

Undocumented

added_new: bool =

Undocumented

request =

Undocumented

used: bool =
@property
_loaded_messages =
Return a list of loaded messages, retrieving them first if they have not been loaded yet.