
    hk                         S SK Jr  S SKJrJr   " S S5      r " S S\\5      r " S S\\5      r " S	 S
\\5      r	 " S S\5      rg)    )Feed)	Atom1FeedRss201rev2Feedc                   2    \ rS rSrSrS rSS jrSS jrSrg)	GeoFeedMixin   zy
This mixin provides the necessary routines for SyndicationFeed subclasses
to produce simple GeoRSS or W3C Geo elements.
c                 2    SR                  S U 5       5      $ )z
In GeoRSS coordinate pairs are ordered by lat/lon and separated by
a single white space. Given a tuple of coordinates, return a string
GeoRSS representation.
 c              3   <   #    U  H  nS US   US   4-  v   M     g7f)z%f %f   r   N ).0coords     J/var/www/html/env/lib/python3.13/site-packages/django/contrib/gis/feeds.py	<genexpr>-GeoFeedMixin.georss_coords.<locals>.<genexpr>   s"     KF558U1X"66Fs   )join)selfcoordss     r   georss_coordsGeoFeedMixin.georss_coords   s     xxKFKKK    c                     U(       a2  USS u  pEUR                  SSU-  5        UR                  SSU-  5        gUR                  SU R                  U45      5        g)z
Adds a GeoRSS point with the given coords using the given handler.
Handles the differences between simple GeoRSS and the more popular
W3C Geo specification.
N   zgeo:latz%fzgeo:lonzgeorss:point)addQuickElementr   )r   handlerr   w3c_geolonlats         r   add_georss_pointGeoFeedMixin.add_georss_point   sY     bqzHC##Itcz:##Itcz:##ND4F4Fy4QRr   c                    UR                  S5      nUGb  [        U[        [        45      (       a  Sn[        US   [        [        45      (       a  [	        U5      S:X  a  UnOP[        S5      e[	        U5      S:X  a  U R                  XUS9  O%[	        U5      S:X  a  USS USS 4nO[        S5      eUb4  U(       a  [        S	5      eUR                  S
U R                  U5      5        gg[        UR                  5      R                  5       nUS:X  a  U R                  XR                  US9  gU(       a  [        S5      eUS;   a,  UR                  SU R                  UR                  5      5        gUS;   a/  UR                  SU R                  US   R                  5      5        g[        SUR                  -  5      eg)z:Add a GeoRSS XML element using the given item and handler.geometryNr   r   z'Only should be two sets of coordinates.r      z'Only should be 2 or 4 numeric elements.z.Cannot use simple GeoRSS box in W3C Geo feeds.z
georss:boxpointz'W3C Geo only supports Point geometries.)
linestring
linearringzgeorss:line)polygonzgeorss:polygonz!Geometry type "%s" not supported.)get
isinstancelisttuplelen
ValueErrorr    r   r   str	geom_typelowerr   )r   r   itemr   geom
box_coordsgtypes          r   add_georss_elementGeoFeedMixin.add_georss_element    s    xx
#$u.. "
d1ge}554yA~%)
()RSS4yA~--gW-MTa&*2AhQR%9
()RSS)(L  ++$d&8&8&D * DNN+113G#))';;)P()RSS  <<//)4+=+=dkk+J ,.//,d.@.@a.P )?$..P c r   r   N)F)	__name__
__module____qualname____firstlineno____doc__r   r    r7   __static_attributes__r   r   r   r   r      s    
LS7r   r   c                   @   ^  \ rS rSrU 4S jrU 4S jrU 4S jrSrU =r$ )
GeoRSSFeed[   c                 .   > [         TU ]  5       nSUS'   U$ Nzhttp://www.georss.org/georsszxmlns:georsssuperrss_attributesr   attrs	__class__s     r   rF   GeoRSSFeed.rss_attributes\   s    &( >nr   c                 F   > [         TU ]  X5        U R                  X5        g NrE   add_item_elementsr7   r   r   r3   rI   s      r   rN   GeoRSSFeed.add_item_elementsa       !'0.r   c                 Z   > [         TU ]  U5        U R                  XR                  5        g rL   rE   add_root_elementsr7   feedr   r   rI   s     r   rT   GeoRSSFeed.add_root_elementse   "    !'*3r   r   	r9   r:   r;   r<   rF   rN   rT   r>   __classcell__rI   s   @r   r@   r@   [       
/4 4r   r@   c                   @   ^  \ rS rSrU 4S jrU 4S jrU 4S jrSrU =r$ )GeoAtom1Feedj   c                 .   > [         TU ]  5       nSUS'   U$ rC   )rE   root_attributesrG   s     r   ra   GeoAtom1Feed.root_attributesk   s    ') >nr   c                 F   > [         TU ]  X5        U R                  X5        g rL   rM   rO   s      r   rN   GeoAtom1Feed.add_item_elementsp   rQ   r   c                 Z   > [         TU ]  U5        U R                  XR                  5        g rL   rS   rV   s     r   rT   GeoAtom1Feed.add_root_elementst   rX   r   r   )	r9   r:   r;   r<   ra   rN   rT   r>   rZ   r[   s   @r   r^   r^   j   r\   r   r^   c                   @   ^  \ rS rSrU 4S jrU 4S jrU 4S jrSrU =r$ )
W3CGeoFeedy   c                 .   > [         TU ]  5       nSUS'   U$ )Nz(http://www.w3.org/2003/01/geo/wgs84_pos#z	xmlns:georD   rG   s     r   rF   W3CGeoFeed.rss_attributesz   s    &(Gkr   c                 D   > [         TU ]  X5        U R                  XSS9  g NTr$   rM   rO   s      r   rN   W3CGeoFeed.add_item_elements   s#    !'0t<r   c                 X   > [         TU ]  U5        U R                  XR                  SS9  g rm   rS   rV   s     r   rT   W3CGeoFeed.add_root_elements   s'    !'*DAr   r   rY   r[   s   @r   rh   rh   y   s    
=B Br   rh   c                   (    \ rS rSrSr\rS rS rSr	g)r      z
This is a subclass of the `Feed` from `django.contrib.syndication`.
This allows users to define a `geometry(obj)` and/or `item_geometry(item)`
methods on their own subclasses so that geo-referenced information may
placed in the feed.
c                 *    SU R                  SU5      0$ )Nr#   _get_dynamic_attr)r   objs     r   feed_extra_kwargsFeed.feed_extra_kwargs   s    D22:sCDDr   c                 *    SU R                  SU5      0$ )Nr#   item_geometryrt   )r   r3   s     r   item_extra_kwargsFeed.item_extra_kwargs   s    D22?DIJJr   r   N)
r9   r:   r;   r<   r=   r@   	feed_typerw   r{   r>   r   r   r   r   r      s     IEKr   r   N)
 django.contrib.syndication.viewsr   BaseFeeddjango.utils.feedgeneratorr   r   r   r@   r^   rh   r   r   r   <module>r      sR    = @R Rl4 449l 4B B K8 Kr   