a
    Kcòf²  ã                   @   s„   d dl mZ d dlmZ dZG dd„ deƒZddd	„Zd
d„ Zdd„ Z	dd„ Z
ddd„Zddd„Zddd„Zddd„Zd dd„ZdS )!é    )Ú	constants)Údefault_storage)
Úadd_messageÚget_messagesÚ	get_levelÚ	set_levelÚdebugÚinfoÚsuccessÚwarningÚerrorÚMessageFailurec                   @   s   e Zd ZdS )r   N)Ú__name__Ú
__module__Ú__qualname__© r   r   úX/home/httpd/docs/test/DocsMgr/lib/python3.9/site-packages/django/contrib/messages/api.pyr      s   r   Ú Fc                 C   sV   z
| j }W n8 tyB   t| dƒs2td| jj ƒ‚|s>tdƒ‚Y n0 | |||¡S dS )zK
    Attempt to add a message to the request using the 'messages' app.
    ZMETAz?add_message() argument must be an HttpRequest object, not '%s'.z_You cannot add messages without installing django.contrib.messages.middleware.MessageMiddlewareN)Ú	_messagesÚAttributeErrorÚhasattrÚ	TypeErrorÚ	__class__r   r   Úadd)ÚrequestÚlevelÚmessageÚ
extra_tagsÚfail_silentlyÚmessagesr   r   r   r      s    

ÿÿÿ
r   c                 C   s   t | dg ƒS )ze
    Return the message storage on the request if it exists, otherwise return
    an empty list.
    r   )Úgetattr)r   r   r   r   r   +   s    r   c                 C   s   t | dt| ƒƒ}|jS )z©
    Return the minimum level of messages to be recorded.

    The default level is the ``MESSAGE_LEVEL`` setting. If this is not found,
    use the ``INFO`` level.
    r   )r    r   r   )r   Zstorager   r   r   r   3   s    r   c                 C   s   t | dƒsdS || j_dS )zÊ
    Set the minimum level of messages to be recorded, and return ``True`` if
    the level was recorded successfully.

    If set to ``None``, use the default level (see the get_level() function).
    r   FT)r   r   r   )r   r   r   r   r   r   >   s    
r   c                 C   s   t | tj|||d� dS )z'Add a message with the ``DEBUG`` level.©r   r   N)r   r   ÚDEBUG©r   r   r   r   r   r   r   r   K   s    ûr   c                 C   s   t | tj|||d� dS )z&Add a message with the ``INFO`` level.r!   N)r   r   ÚINFOr#   r   r   r   r	   V   s    ûr	   c                 C   s   t | tj|||d� dS )z)Add a message with the ``SUCCESS`` level.r!   N)r   r   ÚSUCCESSr#   r   r   r   r
   a   s    ûr
   c                 C   s   t | tj|||d� dS )z)Add a message with the ``WARNING`` level.r!   N)r   r   ÚWARNINGr#   r   r   r   r   l   s    ûr   c                 C   s   t | tj|||d� dS )z'Add a message with the ``ERROR`` level.r!   N)r   r   ÚERRORr#   r   r   r   r   w   s    ûr   N)r   F)r   F)r   F)r   F)r   F)r   F)Zdjango.contrib.messagesr   Zdjango.contrib.messages.storager   Ú__all__Ú	Exceptionr   r   r   r   r   r   r	   r
   r   r   r   r   r   r   Ú<module>   s   




