î
ªÍ XÏ  ã               @   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	 Wn e
 k
 rv d Z	 Yn Xd d „  Z d	 d
 „  Z d d „  Z d d „  Z d S)é    N)ÚBytesIO)Úsettings)ÚHttpResponse)ÚloaderFc             C   s^   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   úJ/home/ubuntu/projects/ifolica/build/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).Úcontent_typez$application/vnd.google-earth.kml+xml)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).
    r   z application/vnd.google-earth.kmz)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.r   z
text/plain)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   
