î
ªÍ X!  ã            
   @   sà   d  d l  m Z d  d l m Z d  d l m Z d Z Gd d „  d e ƒ Z d d d d „ Z	 d d „  Z
 d d „  Z d d „  Z d d d d „ Z d d d d	 „ Z d d d d
 „ Z d d d d „ Z d d d d „ Z d S)é    )Ú	constants)Údefault_storage)ÚHttpRequestÚ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   úI/home/ubuntu/projects/ifolica/build/django/django/contrib/messages/api.pyr      s   Ú Fc             C   sf   t  |  t ƒ s( t d |  j j ƒ ‚ n  t |  d ƒ rM |  j j | | | ƒ S| sb t d ƒ ‚ n  d S)zL
    Attempts to add a message to the request using the 'messages' app.
    z?add_message() argument must be an HttpRequest object, not '%s'.Ú	_messagesz_You cannot add messages without installing django.contrib.messages.middleware.MessageMiddlewareN)	Ú
isinstancer   Ú	TypeErrorÚ	__class__r   Úhasattrr   Úaddr   )ÚrequestÚlevelÚmessageÚ
extra_tagsÚfail_silentlyr   r   r   r      s    c             C   s   t  |  d g  ƒ S)zg
    Returns the message storage on the request if it exists, otherwise returns
    an empty list.
    r   )Úgetattr)r   r   r   r   r   !   s    c             C   s   t  |  d t |  ƒ ƒ } | j S)z®
    Returns the minimum level of messages to be recorded.

    The default level is the ``MESSAGE_LEVEL`` setting. If this is not found,
    the ``INFO`` level is used.
    r   )r    r   r   )r   Zstorager   r   r   r   )   s    c             C   s#   t  |  d ƒ s d S| |  j _ d S)z×
    Sets the minimum level of messages to be recorded, returning ``True`` if
    the level was recorded successfully.

    If set to ``None``, the default level will be used (see the ``get_level``
    method).
    r   FT)r   r   r   )r   r   r   r   r   r   4   s    c             C   s#   t  |  t j | d | d | ƒd S)z2
    Adds a message with the ``DEBUG`` level.
    r   r   N)r   r   ÚDEBUG)r   r   r   r   r   r   r   r	   B   s    c             C   s#   t  |  t j | d | d | ƒd S)z1
    Adds a message with the ``INFO`` level.
    r   r   N)r   r   ÚINFO)r   r   r   r   r   r   r   r
   J   s    c             C   s#   t  |  t j | d | d | ƒd S)z4
    Adds a message with the ``SUCCESS`` level.
    r   r   N)r   r   ÚSUCCESS)r   r   r   r   r   r   r   r   R   s    c             C   s#   t  |  t j | d | d | ƒd S)z4
    Adds a message with the ``WARNING`` level.
    r   r   N)r   r   ÚWARNING)r   r   r   r   r   r   r   r   Z   s    c             C   s#   t  |  t j | d | d | ƒd S)z2
    Adds a message with the ``ERROR`` level.
    r   r   N)r   r   ÚERROR)r   r   r   r   r   r   r   r   b   s    N)
zadd_messagezget_messagesz	get_levelz	set_levelzdebugzinfozsuccesszwarningzerrorzMessageFailure)Zdjango.contrib.messagesr   Zdjango.contrib.messages.storager   Zdjango.httpr   Ú__all__Ú	Exceptionr   r   r   r   r   r	   r
   r   r   r   r   r   r   r   Ú<module>   s       