3
(h                 @   s   d dl Z d dlmZ d dlmZ d dlmZ d dlmZ yd dl	Z	W n e
k
r\   dZ	Y nX dd Zd	d
 Zdd Zdd ZdS )    N)BytesIO)settings)HttpResponse)loaderFc             C   sD   t  }tj|dtj}|jd| jtj |j  |j	d |j
 S )z1Returns compressed KMZ from the given KML string.azdoc.kmlr   )r   zipfileZipFileZIP_DEFLATEDwritestrencoder   DEFAULT_CHARSETcloseseekread)ZkmlZkmzzf r   @/tmp/pip-install-q3hcpn_q/Django/django/contrib/gis/shortcuts.pycompress_kml   s    
r   c              O   s   t tj| |ddS )z:Renders the response as KML (using the correct MIME type).z$application/vnd.google-earth.kml+xml)content_type)r   r   render_to_string)argskwargsr   r   r   render_to_kml   s    
r   c              O   s   t ttj| |ddS )zZ
    Compresses the KML content and returns as KMZ (using the correct
    MIME type).
    z application/vnd.google-earth.kmz)r   )r   r   r   r   )r   r   r   r   r   render_to_kmz!   s    r   c              O   s   t tj| |ddS )z8Renders the response using the MIME type for plain text.z
text/plain)r   )r   r   r   )r   r   r   r   r   render_to_text,   s    r   )r   ior   Zdjango.confr   Zdjango.httpr   Zdjango.templater   ZnumpyImportErrorr   r   r   r   r   r   r   r   <module>   s   

