https://t.me/AnonymousX5
Server : Apache
System : Linux cvar2.toservers.com 3.10.0-962.3.2.lve1.5.73.el7.x86_64 #1 SMP Wed Aug 24 21:31:23 UTC 2022 x86_64
User : njnconst ( 1116)
PHP Version : 8.4.18
Disable Function : NONE
Directory :  /lib64/python2.7/site-packages/django/core/serializers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib64/python2.7/site-packages/django/core/serializers/xml_serializer.pyc
�
r�\c@sIdZddlmZddlmZddlmZddlmZm	Z	ddl
mZddlm
Z
ddlmZdd	lmZdd
lmZdejfd��YZd
ejfd��YZd�Zdefd��YZdefd��YZdefd��YZdefd��YZdefd��YZdS(u
XML serializer.
i����(tunicode_literals(tsettings(tbase(tmodelstDEFAULT_DB_ALIAS(tSimplerXMLGenerator(t
smart_text(tpulldom(thandler(tExpatParsert
SerializercBs_eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�ZRS(
u'
    Serializes a QuerySet to XML.
    cCsM|jjdd�dk	rI|jjdd|jjdd�|�ndS(Nuindentu
u (toptionstgettNonetxmltignorableWhitespace(tselftlevel((sH/tmp/pip-install-XxeQeY/django/django/core/serializers/xml_serializer.pytindentscCsRt|j|jjdtj��|_|jj�|jjdidd6�dS(uT
        Start serialization -- open the XML document and the root element.
        uencodingudjango-objectsu1.0uversionN(	RtstreamRRRtDEFAULT_CHARSETRt
startDocumenttstartElement(R((sH/tmp/pip-install-XxeQeY/django/django/core/serializers/xml_serializer.pytstart_serializations'
cCs.|jd�|jjd�|jj�dS(u8
        End serialization -- end the document.
        iudjango-objectsN(RRt
endElementtendDocument(R((sH/tmp/pip-install-XxeQeY/django/django/core/serializers/xml_serializer.pytend_serialization!s
cCs�t|d�s+tjdt|���n|jd�|j�}|dkriit|j�d6}n)it|j��d6t|j�d6}|j	j
d|�dS(u3
        Called as each object is handled.
        u_metau6Non-model object (%s) encountered during serializationiumodelupkuobjectN(thasattrRtSerializationErrorttypeRt_get_pk_valR
Rt_metaRR(Rtobjtobj_pktattrs((sH/tmp/pip-install-XxeQeY/django/django/core/serializers/xml_serializer.pytstart_object)s
cCs!|jd�|jjd�dS(uA
        Called after handling all fields for an object.
        iuobjectN(RRR(RR ((sH/tmp/pip-install-XxeQeY/django/django/core/serializers/xml_serializer.pyt
end_object<s
cCs�|jd�|jjdi|jd6|j�d6�t||j�dk	rk|jj|j|��n|jj	d�|jj
d�dS(up
        Called to handle each field on an object (except for ForeignKeys and
        ManyToManyFields)
        iufieldunameutypeuNoneN(RRRtnametget_internal_typetgetattrR
t
characterstvalue_to_stringtaddQuickElementR(RR tfield((sH/tmp/pip-install-XxeQeY/django/django/core/serializers/xml_serializer.pythandle_fieldCs

cCs�|j|�t||j��}|dk	r�|jr�t|jjd�r�t||j�}|j	�}x`|D]?}|j
jdi�|j
jt
|��|j
jd�qqWq�|j
jt
|��n|j
jd�|j
jd�dS(uy
        Called to handle a ForeignKey (we need to treat them slightly
        differently from regular fields).
        unatural_keyunaturaluNoneufieldN(t_start_relational_fieldR'tget_attnameR
tuse_natural_keysRtrelttoR%tnatural_keyRRR(RRR*(RR R+trelated_atttrelatedt	key_value((sH/tmp/pip-install-XxeQeY/django/django/core/serializers/xml_serializer.pythandle_fk_fieldVs

cs�|jjjjr��j|��jrOt|jjd�rO�fd�}n�fd�}x*t||j	�j
�D]}||�qwW�jjd�ndS(u�
        Called to handle a ManyToManyField. Related objects are only
        serialized as references to the object's PK (i.e. the related *data*
        is not dumped, just the relation).
        unatural_keycs}|j�}�jjdi�xG|D]?}�jjdi��jjt|���jjd�q&W�jjd�dS(Nuobjectunatural(R2RRR(RR(tvaluetnaturalR5(R(sH/tmp/pip-install-XxeQeY/django/django/core/serializers/xml_serializer.pyt
handle_m2mws
cs-�jjddit|j��d6�dS(NuobjectR"upk(RR*RR(R7(R(sH/tmp/pip-install-XxeQeY/django/django/core/serializers/xml_serializer.pyR9�sufieldN(
R0tthroughRtauto_createdR-R/RR1R'R%titeratorRR(RR R+R9trelobj((RsH/tmp/pip-install-XxeQeY/django/django/core/serializers/xml_serializer.pythandle_m2m_fieldms

cCsT|jd�|jjdi|jd6|jjjd6t|jjj	�d6�dS(uL
        Helper to output the <field> element for relational fields
        iufieldunameurelutoN(
RRRR%R0t	__class__t__name__RR1R(RR+((sH/tmp/pip-install-XxeQeY/django/django/core/serializers/xml_serializer.pyR-�s


(R@t
__module__t__doc__RRRR#R$R,R6R>R-(((sH/tmp/pip-install-XxeQeY/django/django/core/serializers/xml_serializer.pyR
s								tDeserializercBsMeZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	RS(u
    Deserialize XML.
    cKsett|�j||�tj|j|j��|_|jdt	�|_
|jdt�|_dS(Nuusinguignorenonexistent(
tsuperRCt__init__RtparseRt_make_parsertevent_streamtpopRtdbtFalsetignore(Rtstream_or_stringR((sH/tmp/pip-install-XxeQeY/django/django/core/serializers/xml_serializer.pyRE�scCst�S(u;Create a hardened XML parser (no custom/external entities).(tDefusedExpatParser(R((sH/tmp/pip-install-XxeQeY/django/django/core/serializers/xml_serializer.pyRG�scCs\xO|jD]D\}}|dkr
|jdkr
|jj|�|j|�Sq
Wt�dS(Nu
START_ELEMENTuobject(RHtnodeNamet
expandNodet_handle_objectt
StopIteration(Rteventtnode((sH/tmp/pip-install-XxeQeY/django/django/core/serializers/xml_serializer.pyt__next__�s
cCs�|j|d�}|jd�r3|jd�}nd}i|jjj|�|jjj6}i}|jj�}x|j	d�D]}|jd�}|s�t
jd��n|jr�||kr�q�n|jj
|�}	|	jrt|	jtj�r|j||	�||	j<q�|	jrQt|	jtj�rQ|j||	�||	j<q�|j	d�rid}
n|	jt|�j��}
|
||	j<q�Wt
j||�|�S(uC
        Convert an <object> node to a DeserializedObject.
        umodelupkufieldunameu,<field> node is missing the 'name' attributeuNoneN(t_get_model_from_nodethasAttributetgetAttributeR
Rtpkt	to_pythontattnametget_all_field_namestgetElementsByTagNameRtDeserializationErrorRLt	get_fieldR0t
isinstanceRt
ManyToManyRelt_handle_m2m_field_nodeR%tManyToOneRelt_handle_fk_field_nodetgetInnerTexttstriptDeserializedObject(RRTtModelRYtdatatm2m_datatmodel_fieldst
field_nodet
field_nameR+R7((sH/tmp/pip-install-XxeQeY/django/django/core/serializers/xml_serializer.pyRQ�s.%	cCs:|jd�rdSt|jjjd�r�|jd�}|r�g|D]}t|�j�^qG}|jjjj|j	�j
|�}t||jj�}|jjj
jjr�|j}q�n9t|�j�}|jjj
j|jj�j|�}|St|�j�}|jjj
j|jj�j|�SdS(u8
        Handle a <field> node for a ForeignKey
        uNoneuget_by_natural_keyunaturalN(R]R
RR0R1t_default_managerReRft
db_managerRJtget_by_natural_keyR'RmRRYR_RZ(RRTR+tkeystktfield_valueR R!((sH/tmp/pip-install-XxeQeY/django/django/core/serializers/xml_serializer.pyRd�s%$'csbt�jjjd�r-��fd�}n�fd�}g|jd�D]}||�^qLS(u>
        Handle a <field> node for a ManyToManyField.
        uget_by_natural_keycs�|jd�}|rdg|D]}t|�j�^q}�jjjj�j�j|�j	}n$�jjj
j	j|jd��}|S(Nunaturalupk(
R]ReRfR0R1RnRoRJRpRYRRZRX(tnRqRrRsR!(R+R(sH/tmp/pip-install-XxeQeY/django/django/core/serializers/xml_serializer.pytm2m_converts%*$cs"�jjjjj|jd��S(Nupk(R0R1RRYRZRX(Rt(R+(sH/tmp/pip-install-XxeQeY/django/django/core/serializers/xml_serializer.pyt<lambda>suobject(RR0R1RnR](RRTR+Rutc((R+RsH/tmp/pip-install-XxeQeY/django/django/core/serializers/xml_serializer.pyRb�scCs�|j|�}|s4tjd|j|f��nytj|jd��}Wntk
rid}nX|dkr�tjd|j|f��n|S(uo
        Helper to look up a model from a <object model=...> or a <field
        rel=... to=...> node.
        u0<%s> node is missing the required '%s' attributeu.u,<%s> node has invalid model identifier: '%s'N(	RXRR^RORt	get_modeltsplitt	TypeErrorR
(RRTtattrtmodel_identifierRh((sH/tmp/pip-install-XxeQeY/django/django/core/serializers/xml_serializer.pyRVs

(
R@RARBRERGRURQRdRbRV(((sH/tmp/pip-install-XxeQeY/django/django/core/serializers/xml_serializer.pyRC�s				4		cCs�g}xp|jD]e}|j|jks:|j|jkrM|j|j�q|j|jkr|jt|��qqWdj	|�S(u=
    Get all the inner text of a DOM node (recursively).
    u(
t
childNodestnodeTypet	TEXT_NODEtCDATA_SECTION_NODEtappendRitELEMENT_NODEtextendRetjoin(RTt
inner_texttchild((sH/tmp/pip-install-XxeQeY/django/django/core/serializers/xml_serializer.pyRe#s$RNcBsDeZdZd�Zd�Zd�Zd�Zd�Zd�ZRS(uk
    An expat parser hardened against XML bomb attacks.

    Forbids DTDs, external entity references

    cOs=tj|||�|jtjt�|jtjt�dS(N(t_ExpatParserREt
setFeatureRtfeature_external_gesRKtfeature_external_pes(Rtargstkwargs((sH/tmp/pip-install-XxeQeY/django/django/core/serializers/xml_serializer.pyRE=scCst|||��dS(N(tDTDForbidden(RR%tsysidtpubidthas_internal_subset((sH/tmp/pip-install-XxeQeY/django/django/core/serializers/xml_serializer.pytstart_doctype_declBscCst||||||��dS(N(tEntitiesForbidden(RR%tis_parameter_entityR7RR�R�t
notation_name((sH/tmp/pip-install-XxeQeY/django/django/core/serializers/xml_serializer.pytentity_declEscCst|d||||��dS(N(R�R
(RR%RR�R�R�((sH/tmp/pip-install-XxeQeY/django/django/core/serializers/xml_serializer.pytunparsed_entity_declIscCst||||��dS(N(tExternalReferenceForbidden(RtcontextRR�R�((sH/tmp/pip-install-XxeQeY/django/django/core/serializers/xml_serializer.pytexternal_entity_ref_handlerMscCsJtj|�|j}|j|_|j|_|j|_|j	|_
dS(N(R�tresett_parserR�tStartDoctypeDeclHandlerR�tEntityDeclHandlerR�tUnparsedEntityDeclHandlerR�tExternalEntityRefHandler(Rtparser((sH/tmp/pip-install-XxeQeY/django/django/core/serializers/xml_serializer.pyR�Ps
	(	R@RARBRER�R�R�R�R�(((sH/tmp/pip-install-XxeQeY/django/django/core/serializers/xml_serializer.pyRN6s					tDefusedXmlExceptioncBseZdZd�ZRS(uBase exception.cCs
t|�S(N(tstr(R((sH/tmp/pip-install-XxeQeY/django/django/core/serializers/xml_serializer.pyt__repr__[s(R@RARBR�(((sH/tmp/pip-install-XxeQeY/django/django/core/serializers/xml_serializer.pyR�YsR�cBs eZdZd�Zd�ZRS(u&Document type definition is forbidden.cCs2tt|�j�||_||_||_dS(N(RDR�RER%R�R�(RR%R�R�((sH/tmp/pip-install-XxeQeY/django/django/core/serializers/xml_serializer.pyREas		cCs"d}|j|j|j|j�S(Nu7DTDForbidden(name='{}', system_id={!r}, public_id={!r})(tformatR%R�R�(Rttpl((sH/tmp/pip-install-XxeQeY/django/django/core/serializers/xml_serializer.pyt__str__gs(R@RARBRER�(((sH/tmp/pip-install-XxeQeY/django/django/core/serializers/xml_serializer.pyR�_s	R�cBs eZdZd�Zd�ZRS(uEntity definition is forbidden.cCsMtt|�j�||_||_||_||_||_||_dS(N(	RDR�RER%R7RR�R�R�(RR%R7RR�R�R�((sH/tmp/pip-install-XxeQeY/django/django/core/serializers/xml_serializer.pyREns					cCs"d}|j|j|j|j�S(Nu<EntitiesForbidden(name='{}', system_id={!r}, public_id={!r})(R�R%R�R�(RR�((sH/tmp/pip-install-XxeQeY/django/django/core/serializers/xml_serializer.pyR�ws(R@RARBRER�(((sH/tmp/pip-install-XxeQeY/django/django/core/serializers/xml_serializer.pyR�ls		R�cBs eZdZd�Zd�ZRS(u-Resolving an external reference is forbidden.cCs;tt|�j�||_||_||_||_dS(N(RDR�RER�RR�R�(RR�RR�R�((sH/tmp/pip-install-XxeQeY/django/django/core/serializers/xml_serializer.pyRE~s
			cCsd}|j|j|j�S(Nu8ExternalReferenceForbidden(system_id='{}', public_id={})(R�R�R�(RR�((sH/tmp/pip-install-XxeQeY/django/django/core/serializers/xml_serializer.pyR��s(R@RARBRER�(((sH/tmp/pip-install-XxeQeY/django/django/core/serializers/xml_serializer.pyR�|s	N(RBt
__future__Rtdjango.confRtdjango.core.serializersRt	django.dbRRtdjango.utils.xmlutilsRtdjango.utils.encodingRtxml.domRtxml.saxRtxml.sax.expatreaderR	R�R
RCReRNt
ValueErrorR�R�R�R�(((sH/tmp/pip-install-XxeQeY/django/django/core/serializers/xml_serializer.pyt<module>s"��	#


https://t.me/AnonymousX5 - 2025