%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /opt/alt/python27/lib/python2.7/site-packages/paste/
Upload File :
Create Path :
Current File : //opt/alt/python27/lib/python2.7/site-packages/paste/cgiapp.pyo

�
a�Nc@s�dZddlZddlZddlZddlZyddlZWnek
r_dZnXddlm	Z	ddgZ
defd��YZde
fd��YZde
fd	��YZd
e
fd��YZdddd�Zdddd
�ZdS(s%
Application that runs a CGI script.
i����N(t
converterstCGIErrortCGIApplicationcBseZdZRS(s`
    Raised when the CGI script can't be found or doesn't
    act like a proper CGI script.
    (t__name__t
__module__t__doc__(((s=/opt/alt/python27/lib/python2.7/site-packages/paste/cgiapp.pyRscBs)eZdZdedd�Zd�ZRS(s�
    This object acts as a proxy to a CGI application.  You pass in the
    script path (``script``), an optional path to search for the
    script (if the name isn't absolute) (``path``).  If you don't give
    a path, then ``$PATH`` will be used.
    cCs|rtd��n||_|dkrKtjjdd�jd�}n||_d|kr{|jdd�\}}ntjj|�|krxs|jD]C}tjj	tjj
||��r�tjj
||�|_Pq�q�Wtd||jf��n	||_||_
||_dS(Nsjglobal_conf is no longer supported for CGIApplication (use make_cgi_application); please pass None insteadtPATHtt:t?isScript %r not found in path %r(tNotImplementedtscript_filenametNonetostenvirontgettsplittpathtabspathtexiststjointscriptRtinclude_os_environtquery_string(tselftglobal_confRRRRtpath_dir((s=/opt/alt/python27/lib/python2.7/site-packages/paste/cgiapp.pyt__init__#s(	!	!		c

Cs
d|krGtj|jdd��tj|jdd��|d<n|jrbtjj�}ni}xD|D]<}|j�|krot||t	�ro||||<qoqoW|j
dk	r�|jdd�}|r�|d7}n||j
|d<n|j|d<t
j|jgdt
jd	t
jd
t
jd|dtjj|j��}t||�}tr�tjd
kr�t|dtj|�d	|d
|d�nK|jtj|�j��\}}	|	r�|dj|	�n|j|�|js	||j|j�ngS(NtREQUEST_URItSCRIPT_NAMERt	PATH_INFOtQUERY_STRINGt&tSCRIPT_FILENAMEtstdintstdouttstderrtenvtcwdtwin32swsgi.errors(turllibtquoteRRR
Rtcopytuppert
isinstancetstrRRRt
subprocesstPopentPIPERtdirnamet	CGIWritertselecttsystplatformtproc_communicatetStdinReadertfrom_environtcommunicatetreadtwritetheaders_finishedtstatustheaders(
RRtstart_responsetcgi_environtnametoldtproctwriterR#R$((s=/opt/alt/python27/lib/python2.7/site-packages/paste/cgiapp.pyt__call__EsJ#	


			$
	N(RRRRtTrueRRE(((s=/opt/alt/python27/lib/python2.7/site-packages/paste/cgiapp.pyRs
R2cBseZd�Zd�ZRS(cCsC||_||_d|_g|_t|_d|_d|_dS(Ns200 OKR(	RR?R=R>tFalseR<RRDtbuffer(RRR?((s=/opt/alt/python27/lib/python2.7/site-packages/paste/cgiapp.pyRss						cCs�|jr|j|�dS|j|7_xqd|jkr�d|jkr�|jjd�|jjd�kr�|jjdd�\}|_n|jjdd�\}|_|s�t|_|j|j|j�|_|j|j�|`|`|`Pq,d|krt	d|��q,|jdd�\}}|j
�}|j�}|j�dkr�d|krwd|}n||_q,|jj
||f�q,WdS(	Ns
s
iRsBad header line: %rR=t s
%s General(R<RDRHtfindRRFR?R=R>Rtlstriptstriptlowertappend(Rtdatatline1RAtvalue((s=/opt/alt/python27/lib/python2.7/site-packages/paste/cgiapp.pyR;|s8	
3!	
(RRRR;(((s=/opt/alt/python27/lib/python2.7/site-packages/paste/cgiapp.pyR2qs		R7cBs2eZd�Zd�Zee�Zdd�ZRS(cCs||_||_dS(N(R"tcontent_length(RR"RR((s=/opt/alt/python27/lib/python2.7/site-packages/paste/cgiapp.pyR�s	cCs;|jd�}|r$t|�}nd}||d|�S(NtCONTENT_LENGTHis
wsgi.input(Rtint(tclsRtlength((s=/opt/alt/python27/lib/python2.7/site-packages/paste/cgiapp.pyR8�s
cCsh|js
dS|dkr1|jj|j�}n|jjt|j|��}|jt|�8_|S(NR(RRRR"R:tmintlen(Rtsizettext((s=/opt/alt/python27/lib/python2.7/site-packages/paste/cgiapp.pyR:�s	N(RRRR8tclassmethodRR:(((s=/opt/alt/python27/lib/python2.7/site-packages/paste/cgiapp.pyR7�s		cCs�g}g}d}|jo'ttd�}|jri|jj�trY|j|j�qi|jj�n|jr�|j|j�n|j	r�|j|j	�nx�|s�|rxt
j
||g�\}}	}
|j|	kry|d}}dt|�}|r||j|�7}n|s<|jj�|j
|j�qytj|jj�|�}
|
t|�kry||
}qyn|j|kr�tj|jj�d�}|dkr�|jj�|j
|j�n|r�|j|�}n|j|�n|j	|kr�tj|j	j�d�}|dkrM|j	j�|j
|j	�n|re|j|�}n|j|�q�q�Wy|j�Wn(tk
r�}|jdkr��q�nXdS(sf
    Run the given process, piping input/output/errors to the given
    file-like objects (which need not be actual file objects, unlike
    the arguments passed to Popen).  Wait for process to terminate.

    Note: this is taken from the posix version of
    subprocess.Popen.communicate, but made more general through the
    use of file-like objects.
    Rtnewlinesiii
N(tuniversal_newlinesthasattrtopenR"tflushtinputRNtcloseR#R$R3RXR:tremoveR
R;tfilenot_translate_newlinestwaittOSErrorterrno(RCR"R#R$tread_sett	write_settinput_bufferttrans_nltrlisttwlisttxlisttnexttnext_lent
bytes_writtenROte((s=/opt/alt/python27/lib/python2.7/site-packages/paste/cgiapp.pyR6�s^
	
		



c
Cs[|dkr-|jd�p'|jd�}ntj|�}td|d|d|d|�S(s5
    Paste Deploy interface for :class:`CGIApplication`

    This object acts as a proxy to a CGI application.  You pass in the
    script path (``script``), an optional path to search for the
    script (if the name isn't absolute) (``path``).  If you don't give
    a path, then ``$PATH`` will be used.
    RRRRN(RRRtasboolR(RRRRR((s=/opt/alt/python27/lib/python2.7/site-packages/paste/cgiapp.pytmake_cgi_applications
!(RR
R4R.R(R3tImportErrorRt
paste.utilRt__all__t	ExceptionRtobjectRR2R7R6Ru(((s=/opt/alt/python27/lib/python2.7/site-packages/paste/cgiapp.pyt<module>s"

W-M

Zerion Mini Shell 1.0