+
    TjF                        R t ^ RIt^ RIt^ RIt^ RIHt ^ RIHt ^ RIH	t	 ^ RI
Ht ^ RIHt R tR tR	 tR
 t ! R R4      t ! R R4      t ! R R4      t ! R R]4      t ! R R]4      t ! R R]4      t ! R R]4      t]tR# )a  
Syndication feed generation library -- used for generating RSS, etc.

Sample usage:

>>> from django.utils import feedgenerator
>>> feed = feedgenerator.Rss201rev2Feed(
...     title="Poynter E-Media Tidbits",
...     link="http://www.poynter.org/column.asp?id=31",
...     description="A group blog by the sharpest minds in online journalism.",
...     language="en",
... )
>>> feed.add_item(
...     title="Hello",
...     link="http://www.holovaty.com/test/",
...     description="Testing."
... )
>>> with open('test.rss', 'w') as fp:
...     feed.write(fp, 'utf-8')

For definitions of the different versions of RSS, see:
https://web.archive.org/web/20110718035220/http://diveintomark.org/archives/2004/02/04/incompatible-rss
N)StringIO)urlparse)flatatt)
iri_to_uri)SimplerXMLGeneratorc                     \        V \        P                  4      '       g4   \        P                  P                  V \        P                  ! 4       4      p \        P
                  P                  V 4      # N)
isinstancedatetimecombinetimeemailutilsformat_datetimedates   &O/var/www/idalgo/venv/lib/python3.14/site-packages/django/utils/feedgenerator.pyrfc2822_dater   $   sH    dH--..  ((x}}?;;&&t,,    c                 
   \        V \        P                  4      '       g4   \        P                  P                  V \        P                  ! 4       4      p V P	                  4       V P                  4       f	   R,           # R,           # )NZ )r	   r
   r   r   	isoformat	utcoffsetr   s   &r   rfc3339_dater   *   sY    dH--..  ((x}}?>>dnn&6&>sGGBGGr   c                    \        V 4      pRpVe   RVP                  R4      ,          pRVP                  : V: RVP                  : RVP                  : 2# )z|
Create a TagURI.

See
https://web.archive.org/web/20110514113830/http://diveintomark.org/archives/2004/05/28/howto-atom-id
r   z,%sz%Y-%m-%dztag::/)r   strftimehostnamepathfragment)urlr   bitsds   &&  r   get_tag_urir%   0   sG     C=D
ADMM*--#}}aDMMJJr   c                    \         P                  ! 4       pVP                  \        R4      4       VP	                  V 4      # )zs
Return the given stylesheet's mimetype tuple, using a slightly custom
version of Python's mimetypes.guess_type().
ztext/xsl	xsl
text/xsl	xslt)	mimetypes	MimeTypesreadfpr   
guess_type)r"   
mimetypedbs   & r   _guess_stylesheet_mimetyper,   >   s9    
 $$&J h>?@  %%r   c                   Z   a  ] tR t^Nt o RtR	R lt]R 4       t]R 4       tR t	R t
RtV tR# )

StylesheetzAn RSS stylesheetc                *    Wn         W n        W0n        R # r   )_url	_mimetypemedia)selfr"   mimetyper2   s   &&&&r   __init__Stylesheet.__init__Q   s    	!
r   c                ,    \        V P                  4      # r   )r   r0   r3   s   &r   r"   Stylesheet.urlX   s    $))$$r   c                t    V P                   R 8X  d   \        V P                  4      ^ ,          # V P                   # )r   )r1   r,   r"   r8   s   &r   r4   Stylesheet.mimetype\   s,    >>R-dhh7::~~r   c                    R \        V P                  4      RV P                  RV P                  /p\	        V4      P                  4       # )hreftyper2   )r   r0   r4   r2   r   strip)r3   attrss   & r   __str__Stylesheet.__str__b   s>    Jtyy)DMMTZZ

 u~##%%r   c                Z    \        V P                  V P                  V P                  34      # r   )reprr"   r4   r2   r8   s   &r   __repr__Stylesheet.__repr__j   s     TXXt}}djj9::r   )r1   r0   r2   N)r   screen)__name__
__module____qualname____firstlineno____doc__r5   propertyr"   r4   rA   rE   __static_attributes____classdictcell____classdict__s   @r   r.   r.   N   sD      % %  
&; ;r   r.   c                   n   a  ] tR t^nt o RtRR ltRR ltR tR tR t	R t
R	 tR
 tR tR tR tRtV tR# )SyndicationFeedzGBase class for all syndication feeds. Subclasses should provide write()Nc                $   R  pR pT	;'       d    V	 Uu. uF  p\        V4      NK  	  upp	VeL   \        V\        \         34      '       d   \        RVP                   24      hV Uu. uF  pV! V4      NK  	  ppRV! V4      R\        V4      RV! V4      RV! V4      RV! V4      R	V! V4      R
\        V4      RV! V4      RT	;'       g    RR\        V
4      RV! V4      RT;'       g    TRV! V4      RV/VCV n        . V n        R# u upi u upi )c                 $    V e   \        V 4      # T # r   strss   &r   to_str(SyndicationFeed.__init__.<locals>.to_str       ]3q611r   c                 H    \        V \        4      '       d   V # \        V 4      # r   )r	   r.   rX   s   &r   to_stylesheet/SyndicationFeed.__init__.<locals>.to_stylesheet   s    "1j111Dz!}Dr   Nz"stylesheets should be a list, not titlelinkdescriptionlanguageauthor_emailauthor_nameauthor_linksubtitle
categoriesfeed_urlfeed_copyrightidttlstylesheets )rW   r	   r.   	TypeError	__class__r   feeditems)r3   r`   ra   rb   rc   rd   re   rf   rg   rh   ri   rj   	feed_guidrl   rm   kwargsrZ   r^   crY   s   &&&&&&&&&&&&&&&,    r   r5   SyndicationFeed.__init__q   s6   $	2	E  @@Z$@ZSVZ$@
"+
C'89989N9N8OP  6AA[=+[KA VE]Jt$6+.x(F<06+.:k2x(***
8,f^4)##t6#;;
 
	" 
5 %A Bs   D(Dc           "     |   R pT;'       d    V Uu. uF  pV! V4      NK  	  uppV P                   P                  RV! V4      R\        V4      RV! V4      RV! V4      RV! V4      R\        V4      RTR	TR
V! V4      RV! V	4      RT
RT;'       g    RRT;'       g    RRV! V4      RV! V4      /VC4       R# u upi )z
Add an item to the feed. All args are expected to be strings except
pubdate and updateddate, which are datetime.datetime objects, and
enclosures, which is an iterable of instances of the Enclosure class.
c                 $    V e   \        V 4      # T # r   rV   rX   s   &r   rZ   (SyndicationFeed.add_item.<locals>.to_str   r\   r   r`   ra   rb   rd   re   rf   pubdateupdateddatecomments	unique_idunique_id_is_permalink
enclosuresrh   item_copyrightrl   Nrn   )rr   appendr   )r3   r`   ra   rb   rd   re   rf   rz   r|   r}   r~   rh   r   rl   r{   r   rt   rZ   ru   s   &&&&&&&&&&&&&&&&,  r   add_itemSyndicationFeed.add_item   s    2	2  CC
$C
1VAY
$C



4(vk2| 4vk2z+67{F8,VI.(*@j..Bj..B &"8vc{  !	
 %Ds   B9c                ,    \        V P                  4      # r   )lenrr   r8   s   &r   	num_itemsSyndicationFeed.num_items   s    4::r   c                    / # )z`
Return extra attributes to place on the root (i.e. feed/channel)
element. Called from write().
rn   r8   s   &r   root_attributesSyndicationFeed.root_attributes   	    
 	r   c                    R# )zL
Add elements in the root (i.e. feed/channel) element. Called
from write().
Nrn   r3   handlers   &&r   add_root_elements!SyndicationFeed.add_root_elements   s    
 	r   c                    R# )z5
Add stylesheet(s) to the feed. Called from write().
Nrn   r   s   &&r   add_stylesheetsSyndicationFeed.add_stylesheets        	r   c                    / # )zJ
Return extra attributes to place on each item (i.e. item/entry)
element.
rn   )r3   items   &&r   item_attributesSyndicationFeed.item_attributes   r   r   c                    R# )z6
Add elements on each item (i.e. item/entry) element.
Nrn   r3   r   r   s   &&&r   add_item_elements!SyndicationFeed.add_item_elements   r   r   c                    \        R4      h)zq
Output the feed in the given encoding to outfile, which is a file-like
object. Subclasses should override this.
z;subclasses of SyndicationFeed must provide a write() method)NotImplementedError)r3   outfileencodings   &&&r   writeSyndicationFeed.write   s    
 "I
 	
r   c                X    \        4       pV P                  W!4       VP                  4       # )z4
Return the feed in the given encoding as a string.
)r   r   getvalue)r3   r   rY   s   && r   writeStringSyndicationFeed.writeString  s#     J

1zz|r   c                   RpRpV P                    F5  pV F,  pVP                  V4      pV'       g   K  Ve	   WQ8  g   K*  TpK.  	  K7  	  T;'       g/    \        P                  P                  \        P                  R7      # )z
Return the latest item's pubdate or updateddate. If no items
have either of these attributes this return the current UTC date/time.
N)tz)r{   rz   )rr   getr
   nowUTC)r3   latest_date	date_keysr   date_key	item_dates   &     r   latest_post_date SyndicationFeed.latest_post_date  sq    
 .	JJD% HHX.	9"*i.E&/	 &  DDh//33x||3DDr   )rq   rr   )NNNNNNNNNNN)NNNNNNNrn   NNNN)rH   rI   rJ   rK   rL   r5   r   r   r   r   r   r   r   r   r   r   rN   rO   rP   s   @r   rS   rS   n   sH     M2h0
d
E Er   rS   c                   *   a  ] tR tRt o RtR tRtV tR# )	Enclosurei  zAn RSS enclosurec                B    W#uV n         V n        \        V4      V n        R# )z#All args are expected to be stringsN)length	mime_typer   r"   )r3   r"   r   r   s   &&&&r   r5   Enclosure.__init__!  s    &,#T^c?r   )r   r   r"   N)rH   rI   rJ   rK   rL   r5   rN   rO   rP   s   @r   r   r     s     # #r   r   c                   H   a  ] tR tRt o RtR tR tR tR tR t	R t
R	tV tR
# )RssFeedi'  z"application/rss+xml; charset=utf-8c                j   \        WR R7      pVP                  4        V P                  V4       VP                  RV P	                  4       4       VP                  RV P                  4       4       V P                  V4       V P                  V4       V P                  V4       VP                  R4       R# )Tshort_empty_elementsrsschannelN)
r   startDocumentr   startElementrss_attributesr   r   write_itemsendChannelElement
endElementr3   r   r   r   s   &&& r   r   RssFeed.write*  s    %gdS 	W%UD$7$7$9:Y(<(<(>?w'!w'5!r   c                "    R V P                   RR/# )versionz
xmlns:atomhttp://www.w3.org/2005/Atom)_versionr8   s   &r   r   RssFeed.rss_attributes7  s    t}}7
 	
r   c                    V P                    FF  pVP                  R V P                  V4      4       V P                  W4       VP	                  R 4       KH  	  R# )r   Nrr   r   r   r   r   r   s   && r   r   RssFeed.write_items=  sG    JJD  )=)=d)CD""71v& r   c                r    V P                   R ,          ;'       g    .  F  pVP                  RV4       K  	  R# )rm   zxml-stylesheetN)rq   processingInstruction)r3   r   
stylesheets   && r   r   RssFeed.add_stylesheetsC  s1    ))M288b8J))*:JG 9r   c           	     P   VP                  R V P                  R ,          4       VP                  RV P                  R,          4       VP                  RV P                  R,          4       V P                  R,          e)   VP                  RRRRRV P                  R,          /4       V P                  R	,          e$   VP                  R	V P                  R	,          4       V P                  R
,           F  pVP                  RV4       K  	  V P                  R,          e$   VP                  RV P                  R,          4       VP                  R\        V P                  4       4      4       V P                  R,          e&   VP                  RV P                  R,          4       R# R# )r`   ra   rb   ri   Nz	atom:linkrelr3   r=   rc   rh   categoryrj   	copyrightlastBuildDaterl   )addQuickElementrq   r   r   r3   r   cats   && r   r   RssFeed.add_root_elementsG  sH   7);<		&(9:tyy/GH99Z ,##TE66499Z;P#Q 99Z ,##J		*0EF99\**C##J4 +99%&2##K;K1LMd>S>S>U1VW99U'##E499U+;< (r   c                (    VP                  R 4       R# )r   N)r   r   s   &&r   r   RssFeed.endChannelElementY  s    9%r   rn   N)rH   rI   rJ   rK   content_typer   r   r   r   r   r   rN   rO   rP   s   @r   r   r   '  s.     7L"
'H=$& &r   r   c                   *   a  ] tR tRt o RtR tRtV tR# )RssUserland091Feedi]  z0.91c                    VP                  R VR ,          4       VP                  RVR,          4       VR,          e   VP                  RVR,          4       R# R# )r`   ra   rb   N)r   r   s   &&&r   r   $RssUserland091Feed.add_item_elements`  sO    g7V5*##M43FG +r   rn   NrH   rI   rJ   rK   r   r   rN   rO   rP   s   @r   r   r   ]  s     HH Hr   r   c                   *   a  ] tR tRt o RtR tRtV tR# )Rss201rev2Feedig  z2.0c           
        VP                  R VR ,          4       VP                  RVR,          4       VR,          e   VP                  RVR,          4       VR,          '       d9   VR,          '       d*   VP                  RVR,          : RVR,          : R24       MTVR,          '       d   VP                  RVR,          4       M+VR,          '       d   VP                  R	VR,          R
R/4       VR,          e#   VP                  R\        VR,          4      4       VR,          e   VP                  RVR,          4       VR,          ee   / p\        VP                  R4      \        4      '       d$   \        VR,          4      P                  4       VR&   VP                  RVR,          V4       VR,          e   VP                  RVR,          4       VR,          '       dn   \        VR,          4      p\        V4      ^8  d   \        R4      hV^ ,          pVP                  RRRVP                  RVP                  RVP                  /4       VR,           F  pVP                  RV4       K  	  R# )r`   ra   rb   Nre   rd   authorz ()z
dc:creatorzxmlns:dcz http://purl.org/dc/elements/1.1/rz   pubDater|   r}   r~   isPermaLinkguidrl   r   zrRSS feed items may only have one enclosure, see http://www.rssboard.org/rss-profile#element-channel-item-enclosure	enclosurer   r"   r   r>   rh   r   )r   r   r	   r   boolrW   lowerlistr   
ValueErrorr"   r   r   )r3   r   r   
guid_attrsr   r   r   s   &&&    r   r    Rss201rev2Feed.add_item_elementsk  s9   g7V5*##M43FG 4#7#7##tN';';T-=P=PQ .!!##Hd>.BC-  ##]#?@ 	?&##I|DO/LM
'##JZ0@A(J$((#;<dCC,/5M0N,O,U,U,W
=)##FD,=zJ;"##E4;7 d<01J:" Y  #1I##9==i..I// %%C##J4 &r   rn   Nr   rP   s   @r   r   r   g  s     H55 55r   r   c                   F   a  ] tR tRt o RtRtR tR tR tR t	R t
R	tV tR
# )	Atom1Feedi  z#application/atom+xml; charset=utf-8r   c                    \        WR R7      pVP                  4        VP                  RV P                  4       4       V P	                  V4       V P                  V4       VP                  R4       R# )Tr   rq   N)r   r   r   r   r   r   r   r   s   &&& r   r   Atom1Feed.write  s]    %gdSVT%9%9%;<w'!6"r   c                    V P                   R ,          e"   RV P                  RV P                   R ,          /# RV P                  /# )rc   xmlnszxml:lang)rq   nsr8   s   &r   r   Atom1Feed.root_attributes  s<    99Z ,TWWj$))J2GHHTWW%%r   c           	        VP                  R V P                  R ,          4       VP                  RRRRRV P                  R,          /4       V P                  R,          e)   VP                  RRRRRV P                  R,          /4       VP                  R	V P                  R	,          4       VP                  R
\        V P                  4       4      4       V P                  R,          e   VP	                  R/ 4       VP                  RV P                  R,          4       V P                  R,          e$   VP                  RV P                  R,          4       V P                  R,          e$   VP                  RV P                  R,          4       VP                  R4       V P                  R,          e$   VP                  RV P                  R,          4       V P                  R,           F  pVP                  RRRV/4       K  	  V P                  R,          e&   VP                  RV P                  R,          4       R# R# )r`   ra   r   r   	alternater=   ri   Nr3   rk   updatedre   r   namerd   r   rf   urirg   rh   r   termrj   rights)r   rq   r   r   r   r   r   s   && r   r   Atom1Feed.add_root_elements  s   7);<BVTYYv5FG	
 99Z ,##UFFDIIj4IJ 	diio6	<8M8M8O+PQ99]#/  2.##FDIIm,DEyy(4''>1JKyy'3''tyy/GHx(99Z ,##J		*0EF99\**C##JVSMB +99%&2##Hdii8H.IJ 3r   c                    V P                    FF  pVP                  R V P                  V4      4       V P                  W4       VP	                  R 4       KH  	  R# )entryNr   r   s   && r   r   Atom1Feed.write_items  sG    JJD  $*>*>t*DE""71w' r   c                >   VP                  R VR ,          4       VP                  RRRVR,          RR/4       VR,          e#   VP                  R\        VR,          4      4       VR	,          e#   VP                  R
\        VR	,          4      4       VR,          e   VP                  R/ 4       VP                  RVR,          4       VR,          e   VP                  RVR,          4       VR,          e   VP                  RVR,          4       VP                  R4       VR,          e   VR,          pM\	        VR,          VR,          4      pVP                  RV4       VR,          e   VP                  RVR,          RR/4       VR,           F<  pVP                  RRRRRVP
                  RVP                  RVP                  /4       K>  	  VR,           F  pVP                  RRRV/4       K  	  VR,          e   VP                  RVR,          4       R# R# ) r`   ra   r   r=   r   r   rz   N	publishedr{   r   re   r   r   rd   r   rf   r   r}   rk   rb   summaryr>   htmlr   r   r   rh   r   r   r   r  )r   r   r   r   r%   r"   r   r   )r3   r   r   r}   r   r   s   &&&   r   r   Atom1Feed.add_item_elements  s   g7VT&\5+,VW	?&##Kd9o1NO*##I|D<O/PQ *  2.##FD,?@N#/''n1EFM".''tM/BCx( ([)I#DL$y/BIi0 *##ItM/BVVDTU l++I##;IMMi..I//		 , %%C##JVSMB &  !-##Hd3C.DE .r   rn   N)rH   rI   rJ   rK   r   r   r   r   r   r   r   rN   rO   rP   s   @r   r   r     s0     8L	&B#&K4(2F 2Fr   r   )rL   r
   r   r'   ior   urllib.parser   django.forms.utilsr   django.utils.encodingr   django.utils.xmlutilsr   r   r   r%   r,   r.   rS   r   r   r   r   r   DefaultFeedrn   r   r   <module>r     s   0     ! & , 5-HK& ; ;@mE mE`# #3&o 3&lH H95W 95xeF eFT r   