
    g
                     l    d dl mZ d dlmZ d dlmZ d dlmZ d dlm	Z	  G d de      Z
 G d d	e
      Zy
)    )apps)GeometryField)Sitemap)models)reversec                   6    e Zd ZdZdZd	dZd Zd
dZd Zd Z	y)
KMLSitemapz1
    A minimal hook to produce KML sitemaps.
    kmlNc                 0    | j                  |      | _        y N)_build_kml_sources	locations)selfr   s     w/var/www/python.vincentserveurtest.ovh/public_html/venv/lib/python3.12/site-packages/django/contrib/gis/sitemaps/kml.py__init__zKMLSitemap.__init__   s     00;    c                    g }|t        j                         }|D ]  }t        |t        j                  j
                        rs|j                  j                  D ]Y  }t        |t              s|j                  |j                  j                  |j                  j                  |j                  f       [ t        |t        t        f      r+t        |      dk7  rt!        d      |j                  |       t#        d       |S )z
        Go through the given sources and return a 3-tuple of the application
        label, module name, and field name of every GeometryField encountered
        in the sources.

        If no sources are provided, then all models.
           z?Must specify a 3-tuple of (app_label, module_name, field_name).z)KML Sources must be a model or a 3-tuple.)r   
get_models
isinstancer   base	ModelBase_metafieldsr   append	app_label
model_namenamelisttuplelen
ValueError	TypeError)r   sourceskml_sourcessourcefields        r   r   zKMLSitemap._build_kml_sources   s     ?oo'GF&&++"7"78#\\00E!%7#** & 6 6 & 7 7 %

 1 FT5M2v;!#$'  ""6* KLL' ( r   c                 d    t        j                  | |||      }|D ]  }| j                  |d<    |S )z|
        This method is overridden so the appropriate `geo_format` attribute
        is placed on each URL element.
        )pagesiteprotocol
geo_format)r   get_urlsr,   )r   r)   r*   r+   urlsurls         r   r-   zKMLSitemap.get_urls5   s7    
 4dXNC $C r   c                     | j                   S r   )r   )r   s    r   itemszKMLSitemap.items?   s    ~~r   c                 P    t        d| j                  z  |d   |d   |d   d      S )Nz$django.contrib.gis.sitemaps.views.%sr         )labelmodel
field_name)kwargs)r   r,   )r   objs     r   locationzKMLSitemap.locationB   s5    2T__DQQ!!f
 	
r   r   )r3   NN)
__name__
__module____qualname____doc__r,   r   r   r-   r1   r:    r   r   r	   r	      s(     J<
B
r   r	   c                       e Zd ZdZy)
KMZSitemapkmzN)r;   r<   r=   r,   r?   r   r   rA   rA   M   s    Jr   rA   N)django.appsr   django.contrib.gis.db.modelsr   django.contrib.sitemapsr   	django.dbr   django.urlsr   r	   rA   r?   r   r   <module>rH      s/     6 +  B
 B
J r   