ó
Ūâ0_c        
   @   sĩ   d  d l  m Z d  d l m Z d Z d e f d     YZ d e d  Z d   Z	 d   Z
 d   Z d e d  Z d e d  Z d e d  Z d e d  Z d e d  Z d S(   iĸĸĸĸ(   t	   constants(   t   default_storaget   add_messaget   get_messagest	   get_levelt	   set_levelt   debugt   infot   successt   warningt   errort   MessageFailurec           B   s   e  Z RS(    (   t   __name__t
   __module__(    (    (    s=   /tmp/pip-unpacked-wheel-BAJOf3/django/contrib/messages/api.pyR      s   t    c         C   su   y |  j  } WnN t k
 r] t |  d  sE t d |  j j   n  | sq t d   qq n X| j | | |  Sd S(   sL   
    Attempts to add a message to the request using the 'messages' app.
    t   METAs?   add_message() argument must be an HttpRequest object, not '%s'.s_   You cannot add messages without installing django.contrib.messages.middleware.MessageMiddlewareN(   t	   _messagest   AttributeErrort   hasattrt	   TypeErrort	   __class__R   R   t   add(   t   requestt   levelt   messaget
   extra_tagst   fail_silentlyt   messages(    (    s=   /tmp/pip-unpacked-wheel-BAJOf3/django/contrib/messages/api.pyR      s    c         C   s   t  |  d g   S(   sg   
    Returns the message storage on the request if it exists, otherwise returns
    an empty list.
    R   (   t   getattr(   R   (    (    s=   /tmp/pip-unpacked-wheel-BAJOf3/django/contrib/messages/api.pyR   %   s    c         C   s   t  |  d t |    } | j S(   sŪ   
    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   t   storage(    (    s=   /tmp/pip-unpacked-wheel-BAJOf3/django/contrib/messages/api.pyR   -   s    c         C   s#   t  |  d  s t S| |  j _ t S(   sŨ   
    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   (   R   t   FalseR   R   t   True(   R   R   (    (    s=   /tmp/pip-unpacked-wheel-BAJOf3/django/contrib/messages/api.pyR   8   s    c         C   s#   t  |  t j | d | d | d S(   s2   
    Adds a message with the ``DEBUG`` level.
    R   R   N(   R   R    t   DEBUG(   R   R   R   R   (    (    s=   /tmp/pip-unpacked-wheel-BAJOf3/django/contrib/messages/api.pyR   F   s    c         C   s#   t  |  t j | d | d | d S(   s1   
    Adds a message with the ``INFO`` level.
    R   R   N(   R   R    t   INFO(   R   R   R   R   (    (    s=   /tmp/pip-unpacked-wheel-BAJOf3/django/contrib/messages/api.pyR   N   s    c         C   s#   t  |  t j | d | d | d S(   s4   
    Adds a message with the ``SUCCESS`` level.
    R   R   N(   R   R    t   SUCCESS(   R   R   R   R   (    (    s=   /tmp/pip-unpacked-wheel-BAJOf3/django/contrib/messages/api.pyR   V   s    c         C   s#   t  |  t j | d | d | d S(   s4   
    Adds a message with the ``WARNING`` level.
    R   R   N(   R   R    t   WARNING(   R   R   R   R   (    (    s=   /tmp/pip-unpacked-wheel-BAJOf3/django/contrib/messages/api.pyR	   ^   s    c         C   s#   t  |  t j | d | d | d S(   s2   
    Adds a message with the ``ERROR`` level.
    R   R   N(   R   R    t   ERROR(   R   R   R   R   (    (    s=   /tmp/pip-unpacked-wheel-BAJOf3/django/contrib/messages/api.pyR
   f   s    N(
   R   R   R   R   R   R   R   R	   R
   R   (   t   django.contrib.messagesR    t   django.contrib.messages.storageR   t   __all__t	   ExceptionR   R   R   R   R   R   R   R   R   R	   R
   (    (    (    s=   /tmp/pip-unpacked-wheel-BAJOf3/django/contrib/messages/api.pyt   <module>   s      			