ó
EõMPc           @   s  d  Z  d d l m Z m Z d d l m Z d e f d „  ƒ  YZ d e e f d „  ƒ  YZ	 d e j
 e f d	 „  ƒ  YZ e j r‰ e Z n e	 Z e Z d
 e f d „  ƒ  YZ d e e f d „  ƒ  YZ d e j
 e f d „  ƒ  YZ e j rò e Z n e Z e Z d „  Z d „  Z d S(   s8  
Functions for working with "safe strings": strings that can be displayed safely
without further escaping in HTML. Marking something as a "safe string" means
that the producer of the string has already turned characters that should not
be interpreted by the HTML engine (e.g. '<') into the appropriate entities.
iÿÿÿÿ(   t   curryt   Promise(   t   sixt
   EscapeDatac           B   s   e  Z RS(    (   t   __name__t
   __module__(    (    (    s0   ../Django//lib/python/django/utils/safestring.pyR   
   s   t   EscapeBytesc           B   s   e  Z d  Z RS(   s@   
    A byte string that should be HTML-escaped when output.
    (   R   R   t   __doc__(    (    (    s0   ../Django//lib/python/django/utils/safestring.pyR      s   t
   EscapeTextc           B   s   e  Z d  Z RS(   sJ   
    A unicode string object that should be HTML-escaped when output.
    (   R   R   R   (    (    (    s0   ../Django//lib/python/django/utils/safestring.pyR      s   t   SafeDatac           B   s   e  Z RS(    (   R   R   (    (    (    s0   ../Django//lib/python/django/utils/safestring.pyR	       s   t	   SafeBytesc           B   s5   e  Z d  Z d „  Z d „  Z e e d e j ƒZ RS(   sƒ   
    A bytes subclass that has been specifically marked as "safe" (requires no
    further escaping) for HTML output purposes.
    c         C   sN   t  t |  ƒ j | ƒ } t | t ƒ r1 t | ƒ St | t ƒ rJ t | ƒ S| S(   s¡   
        Concatenating a safe byte string with another safe byte string or safe
        unicode string is safe. Otherwise, the result is no longer safe.
        (   t   superR
   t   __add__t
   isinstancet   SafeText(   t   selft   rhst   t(    (    s0   ../Django//lib/python/django/utils/safestring.pyR   (   s    

c         O   sH   | j  d ƒ } | |  | | Ž } t | t ƒ r: t | ƒ St | ƒ Sd S(   s°   
        Wrap a call to a normal unicode method up so that we return safe
        results. The method that is being wrapped is passed in the 'method'
        argument.
        t   methodN(   t   popR   t   bytesR
   R   (   R   t   argst   kwargsR   t   data(    (    s0   ../Django//lib/python/django/utils/safestring.pyt   _proxy_method4   s
    
R   (   R   R   R   R   R   R    R   t   decode(    (    (    s0   ../Django//lib/python/django/utils/safestring.pyR
   #   s   		R   c           B   s8   e  Z d  Z d „  Z d „  Z e e d e j j ƒZ RS(   s‚   
    A unicode (Python 2) / str (Python 3) subclass that has been specifically
    marked as "safe" for HTML output purposes.
    c         C   s5   t  t |  ƒ j | ƒ } t | t ƒ r1 t | ƒ S| S(   s¤   
        Concatenating a safe unicode string with another safe byte string or
        safe unicode string is safe. Otherwise, the result is no longer safe.
        (   R   R   R   R   R	   (   R   R   R   (    (    s0   ../Django//lib/python/django/utils/safestring.pyR   H   s    
c         O   sH   | j  d ƒ } | |  | | Ž } t | t ƒ r: t | ƒ St | ƒ Sd S(   s°   
        Wrap a call to a normal unicode method up so that we return safe
        results. The method that is being wrapped is passed in the 'method'
        argument.
        R   N(   R   R   R   R
   R   (   R   R   R   R   R   (    (    s0   ../Django//lib/python/django/utils/safestring.pyR   R   s
    
R   (	   R   R   R   R   R   R    R   t	   text_typet   encode(    (    (    s0   ../Django//lib/python/django/utils/safestring.pyR   C   s   	
	c         C   sv   t  |  t ƒ r |  St  |  t ƒ s: t  |  t ƒ rD |  j rD t |  ƒ St  |  t j t f ƒ rf t |  ƒ St	 t
 |  ƒ ƒ S(   sÖ   
    Explicitly mark a string as safe for (HTML) output purposes. The returned
    object can be used everywhere a string or unicode object is appropriate.

    Can be called multiple times on a single string.
    (   R   R	   R   R   t   _delegate_bytesR
   R   R   R   t
   SafeStringt   str(   t   s(    (    s0   ../Django//lib/python/django/utils/safestring.pyt	   mark_safeh   s    '

c         C   s|   t  |  t t f ƒ r |  St  |  t ƒ s@ t  |  t ƒ rJ |  j rJ t |  ƒ St  |  t j t f ƒ rl t	 |  ƒ St t |  ƒ ƒ S(   sÜ   
    Explicitly mark a string as requiring HTML escaping upon output. Has no
    effect on SafeData subclasses.

    Can be called multiple times on a single string (the resulting escaping is
    only applied once).
    (
   R   R	   R   R   R   R   R   R   R   R   (   R   (    (    s0   ../Django//lib/python/django/utils/safestring.pyt   mark_for_escapingw   s    '

N(   R   t   django.utils.functionalR    R   t   django.utilsR   t   objectR   R   R   R   R   t   PY3t   EscapeStringt   EscapeUnicodeR	   R
   R   R   t   SafeUnicodeR    R!   (    (    (    s0   ../Django//lib/python/django/utils/safestring.pyt   <module>   s$   		 			