� a�Nc@s�dZddlZddlTdefd��YZdddd�Zedkr�ddlZddl m Z ee �Z d e j Z d �Zd ed �ks�t�d ed�ks�t�e jd�e j�eje �ndS(s� WSGI Test Server This builds upon paste.util.baseserver to customize it for regressions where using raw_interactive won't do. i����N(t*tWSGIRegressionServercBsVeZdZdZd�Zd�Zd�Zd�Zd�Zd�Z dd �Z RS( sN A threaded WSGIServer for use in regression testing. To use this module, call serve(application, regression=True), and then call server.accept() to let it handle one request. When finished, use server.stop() to shutdown the server. Note that all pending requests are processed before the server shuts down. i cOsEtj|||�g|_g|_|j|_|jjd�dS(Ni(t WSGIServert__init__tstoppingtpendingtdefaulttimeoutttimeouttsockett settimeout(tselftargstkwargs((sG/opt/alt/python27/lib/python2.7/site-packages/paste/debug/testserver.pyRs    cCs0ddlm}|d|j�}|j�dS(Ni����(tThreadttarget(t threadingR t serve_pendingtstart(R R tthread((sG/opt/alt/python27/lib/python2.7/site-packages/paste/debug/testserver.pyt serve_forever scCs&|jr"tj�|j|_ndS(N(Rttimetexpires(R ((sG/opt/alt/python27/lib/python2.7/site-packages/paste/debug/testserver.pyt reset_expires$s cOs.tj|||�|jj�|j�dS(N(Rt close_requestRtpopR(R R R ((sG/opt/alt/python27/lib/python2.7/site-packages/paste/debug/testserver.pyR's cCsx|j�xg|j s |jrstj�}||jkrM|jrMdGHPn|jrc|j�ntjd�q WdS(Ns0 WARNING: WSGIRegressionServer timeout exceeded g�������?(RRRRRRthandle_requesttsleep(R tnow((sG/opt/alt/python27/lib/python2.7/site-packages/paste/debug/testserver.pyR+s    cCs|jjt�dS(s/ stop the server (called from tester's thread) N(RtappendtTrue(R ((sG/opt/alt/python27/lib/python2.7/site-packages/paste/debug/testserver.pytstop7sicCs=|j st�gt|�D]}|jjt�^qdS(s6 accept another request (called from tester's thread) N(RtAssertionErrortrangeRRR(R tcounttx((sG/opt/alt/python27/lib/python2.7/site-packages/paste/debug/testserver.pytaccept:s( t__name__t __module__t__doc__RRRRRRRR#(((sG/opt/alt/python27/lib/python2.7/site-packages/paste/debug/testserver.pyRs     cCs/t||||�}d|jGH|j�|S(Nsserving on %s:%s(Rtserver_addressR(t applicationthosttportthandlertserver((sG/opt/alt/python27/lib/python2.7/site-packages/paste/debug/testserver.pytserve?s  t__main__(t dump_environs http://%s:%scCs=tjd�ddl}|jd�tjt|�j�S(Nii����i(R,R#Rtsetdefaulttimeoutturllibturlopentbaseuritread(tpathR((sG/opt/alt/python27/lib/python2.7/site-packages/paste/debug/testserver.pytfetchKs   sPATH_INFO: /foos/foosPATH_INFO: /wombles/womblei(R&Rtpaste.httpserverRRtNoneR-R$R1t paste.wsgilibR/R,R'R3R6RR#RR2(((sG/opt/alt/python27/lib/python2.7/site-packages/paste/debug/testserver.pyt<module> s  /