%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.pyc

�
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.
    cCsA|rtd��n||_|dkrKtjjdd�jd�}n||_d|kr�|dks�td||f��|jdd�\}}ntjj	|�|kr"xs|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?sNYou cannot have '?' in your script name (%r) and also give a query_string (%r)isScript %r not found in path %r(tNotImplementedtscript_filenametNonetostenvirontgettsplittpathtAssertionErrortabspathtexiststjointscriptRtinclude_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tTrueRRF(((s=/opt/alt/python27/lib/python2.7/site-packages/paste/cgiapp.pyRs
R3cBseZd�Zd�ZRS(cCsC||_||_d|_g|_t|_d|_d|_dS(Ns200 OKR(	RR@R>R?tFalseR=RREtbuffer(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=RERItfindRRGR@R>R?Rtlstriptstriptlowertappend(Rtdatatline1RBtvalue((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.pyR3qs		R8cBs2eZd�Zd�Zee�Zdd�ZRS(cCs||_||_dS(N(R#tcontent_length(RR#RS((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.pyR9�s
cCsh|js
dS|dkr1|jj|j�}n|jjt|j|��}|jt|�8_|S(NR(RSRR#R;tmintlen(Rtsizettext((s=/opt/alt/python27/lib/python2.7/site-packages/paste/cgiapp.pyR;�s	N(RRRR9tclassmethodRR;(((s=/opt/alt/python27/lib/python2.7/site-packages/paste/cgiapp.pyR8�s		cCs�g}g}d}|jo'ttd�}|jri|jj�trY|j|j�q{|jj�n|dks{t	�|j
r�|j|j
�n|dks�t	�|jr�|j|j�n|dks�t	�x�|s�|r�tj||g�\}}	}
|j|	kr�|d}}dt
|�}|rL||j|�7}n|sr|jj�|j|j�q�tj|jj�|�}
|
t
|�kr�||
}q�n|j
|kr-tj|j
j�d�}|dkr|j
j�|j|j
�n|r|j|�}n|j|�n|j|kr�tj|jj�d�}|dkr�|jj�|j|j�n|r�|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#tflushtinputROtcloseRRR$R%R4RYR;tremoveR
R<tfilenot_translate_newlinestwaittOSErrorterrno(RDR#R$R%tread_sett	write_settinput_bufferttrans_nltrlisttwlisttxlisttnexttnext_lent
bytes_writtenRPte((s=/opt/alt/python27/lib/python2.7/site-packages/paste/cgiapp.pyR7�sd
	
		



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
R5R/R)R4tImportErrorRt
paste.utilRt__all__t	ExceptionRtobjectRR3R8R7Rv(((s=/opt/alt/python27/lib/python2.7/site-packages/paste/cgiapp.pyt<module>s"

W-M

Zerion Mini Shell 1.0