o
    þÞh²  ã                   @   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   ú[/var/www/html/premium_crap/venv/lib/python3.10/site-packages/django/contrib/messages/api.pyr      s    r   Ú Fc                 C   sT   z| j }W n ty"   t| dƒstd| jj ƒ‚|stdƒ‚Y dS w | |||¡S )zK
    Attempt to add a message to the request using the 'messages' app.
    Ú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   Ú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   ó   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   ó   
ûr   c                 C   r#   )z&Add a message with the ``INFO`` level.r$   N)r   r   ÚINFOr&   r   r   r   r	   V   r'   r	   c                 C   r#   )z)Add a message with the ``SUCCESS`` level.r$   N)r   r   ÚSUCCESSr&   r   r   r   r
   a   r'   r
   c                 C   r#   )z)Add a message with the ``WARNING`` level.r$   N)r   r   ÚWARNINGr&   r   r   r   r   l   r'   r   c                 C   r#   )z'Add a message with the ``ERROR`` level.r$   N)r   r   ÚERRORr&   r   r   r   r   w   r'   r   N)r   F)Údjango.contrib.messagesr   Údjango.contrib.messages.storager   Ú__all__Ú	Exceptionr   r   r   r   r   r   r	   r
   r   r   r   r   r   r   Ú<module>   s    




