class BaseStorage: (source)
Known subclasses: django.contrib.messages.storage.cookie.CookieStorage
, django.contrib.messages.storage.fallback.FallbackStorage
, django.contrib.messages.storage.session.SessionStorage
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 | add |
Queue a message to be stored. |
Method | update |
Store all unread messages. |
Class Variable | level |
Undocumented |
Instance Variable | added |
Undocumented |
Instance Variable | request |
Undocumented |
Instance Variable | used |
Undocumented |
Method | _get |
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... |
Method | _get |
Return the minimum recorded level. |
Method | _prepare |
Prepare a list of messages for storage. |
Method | _set |
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. |
Instance Variable | _level |
Undocumented |
Instance Variable | _queued |
Undocumented |
Property | _loaded |
Return a list of loaded messages, retrieving them first if they have not been loaded yet. |
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``).
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.
django.contrib.messages.storage.cookie.CookieStorage
, django.contrib.messages.storage.fallback.FallbackStorage
, django.contrib.messages.storage.session.SessionStorage
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``.
Return the minimum recorded level. The default level is the ``MESSAGE_LEVEL`` setting. If this is not found, the ``INFO`` level is used.
Set a custom minimum recorded level. If set to ``None``, the default level will be used (see the ``_get_level`` method).
django.contrib.messages.storage.cookie.CookieStorage
, django.contrib.messages.storage.fallback.FallbackStorage
, django.contrib.messages.storage.session.SessionStorage
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.**