B
    CVvgä  ã               @   sH   d Z ddlmZ G dd„ dƒZG dd„ deeƒZeZdd„ Zd	d
„ ZdS )a8  
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.
é    )Úwrapsc               @   s   e Zd Zdd„ ZdS )ÚSafeDatac             C   s   | S )zŸ
        Return the html representation of a string for interoperability.

        This allows other template engines to understand Django's SafeData.
        © )Úselfr   r   ú;/tmp/pip-install-o3oxmrkh/Django/django/utils/safestring.pyÚ__html__   s    zSafeData.__html__N)Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r   r      s   r   c                   s(   e Zd ZdZ‡ fdd„Zdd„ Z‡  ZS )Ú
SafeStringzb
    A str subclass that has been specifically marked as "safe" for HTML output
    purposes.
    c                s"   t ƒ  |¡}t|tƒrt|ƒS |S )z“
        Concatenating a safe string with another safe bytestring or
        safe string is safe. Otherwise, the result is no longer safe.
        )ÚsuperÚ__add__Ú
isinstancer   r   )r   ÚrhsÚt)Ú	__class__r   r   r      s    
zSafeString.__add__c             C   s   | S )Nr   )r   r   r   r   Ú__str__$   s    zSafeString.__str__)r   r	   r
   Ú__doc__r   r   Ú__classcell__r   r   )r   r   r      s   
r   c                s   t ˆ ƒ‡ ‡fdd„ƒ}|S )Nc                 s   ˆˆ | |ŽƒS )Nr   )ÚargsÚkwargs)ÚfuncÚsafety_markerr   r   Úwrapped,   s    z"_safety_decorator.<locals>.wrapped)r   )r   r   r   r   )r   r   r   Ú_safety_decorator+   s    r   c             C   s(   t | dƒr| S t| ƒr tt| ƒS t| ƒS )a  
    Explicitly mark a string as safe for (HTML) output purposes. The returned
    object can be used everywhere a string is appropriate.

    If used on a method as a decorator, mark the returned data as safe.

    Can be called multiple times on a single string.
    r   )ÚhasattrÚcallabler   Ú	mark_safer   )Úsr   r   r   r   2   s
    	

r   N)	r   Ú	functoolsr   r   Ústrr   ZSafeTextr   r   r   r   r   r   Ú<module>   s   
