PNG  IHDR;IDATxܻn0K )(pA 7LeG{ §㻢|ذaÆ 6lذaÆ 6lذaÆ 6lom$^yذag5bÆ 6lذaÆ 6lذa{ 6lذaÆ `}HFkm,mӪôô! x|'ܢ˟;E:9&ᶒ}{v]n&6 h_tڠ͵-ҫZ;Z$.Pkž)!o>}leQfJTu іچ\X=8Rن4`Vwl>nG^is"ms$ui?wbs[m6K4O.4%/bC%t Mז -lG6mrz2s%9s@-k9=)kB5\+͂Zsٲ Rn~GRC wIcIn7jJhۛNCS|j08yiHKֶۛkɈ+;SzL/F*\Ԕ#"5m2[S=gnaPeғL lذaÆ 6l^ḵaÆ 6lذaÆ 6lذa; _ذaÆ 6lذaÆ 6lذaÆ RIENDB`  bNc@sdZddlZddlZddlZddlZyddlZWnek r_eZnXddlm Z ddlm Z ddl m Z ddlm Z ddlmZddl mZd efd YZd d d gZd efdYZdZejdedZejdedZdZdZejded efdYZedZd efdYZddZeeedZdS(sH WSGI applications that parse the URL and dispatch to on-disk resources iN(trequest(tfileapp(t import_string(thttpexceptions(tETAG(t converterst NoDefaultcBseZRS((t__name__t __module__(((s3/usr/lib/python2.7/site-packages/paste/urlparser.pyRst URLParsertStaticURLParsertPkgResourcesParsercBseZdZiZeZiZeeed dZdZ dZ d dZ dZ dZ dZdZeeZd Zd Zd ZRS( s WSGI middleware Application dispatching, based on URL. An instance of `URLParser` is an application that loads and delegates to other applications. It looks for files in its directory that match the first part of PATH_INFO; these may have an extension, but are not required to have one, in which case the available files are searched to find the appropriate file. If it is ambiguous, a 404 is returned and an error logged. By default there is a constructor for .py files that loads the module, and looks for an attribute ``application``, which is a ready application object, or an attribute that matches the module name, which is a factory for building applications, and is called with no arguments. URLParser will also look in __init__.py for special overrides. These overrides are: ``urlparser_hook(environ)`` This can modify the environment. Its return value is ignored, and it cannot be used to change the response in any way. You *can* use this, for example, to manipulate SCRIPT_NAME/PATH_INFO (try to keep them consistent with the original URL -- but consuming PATH_INFO and moving that to SCRIPT_NAME is ok). ``urlparser_wrap(environ, start_response, app)``: After URLParser finds the application, it calls this function (if present). If this function doesn't call ``app(environ, start_response)`` then the application won't be called at all! This can be used to allocate resources (with ``try:finally:``) or otherwise filter the output of the application. ``not_found_hook(environ, start_response)``: If no file can be found (*in this directory*) to match the request, then this WSGI application will be called. You can use this to change the URL and pass the request back to URLParser again, or on to some other application. This doesn't catch all ``404 Not Found`` responses, just missing files. ``application(environ, start_response)``: This basically overrides URLParser completely, and the given application is used for all requests. ``urlparser_wrap`` and ``urlparser_hook`` are still called, but the filesystem isn't searched in any way. c Ks|r%ddl} | jdtni}tjjdkrX|jtjjd}n||_||_|t kr|j dd}nt j ||_ |t kr|j d d}nt j ||_|t kr|j dd}nt j ||_|jj|_|r.|jj|nx|jD]~\} } | jdsotd| | fn| tdj} t| ttfrtj| } n| |j| s(   !     cCs2tjdtj|d|}|j||S(Ns%The resource at %s could not be foundtcomment(Rt HTTPNotFoundRt construct_urltwsgi_application(R,RCRDt debug_messagetexc((s3/usr/lib/python2.7/site-packages/paste/urlparser.pyRAs  cCsutj|dt}|d7}|jdrC|d|d7}ntjd|dd|fg}|j||S(s^ This happens when you try to get to a directory without a trailing / twith_query_stringR t QUERY_STRINGt?sFThe resource has moved to %s - you should be redirected automatically.theaderstlocation(RRRtFalseRRtHTTPMovedPermanentlyRS(R,RCRDturlRU((s3/usr/lib/python2.7/site-packages/paste/urlparser.pyR;s cCs$g}xtj|jD]}tjj|\}}tjj|j|}||jks| rkqn||kr|j|qn||jkrqn||kr|j|qqW|sdSt |dkr||kr|S|dj dt j |dj|fdS|dS(Nis wsgi.errorss$Ambiguous URL: %s; matches files %s s, i(RtlistdirRRtsplitextR@RtappendRR=R&RBRRR(R,RCt base_filenametpossibleRItbaseR1t full_filename((s3/usr/lib/python2.7/site-packages/paste/urlparser.pyRLs2      cCstjj|rd}ntjj|d}|jj||jjd}|dkrb|S||||}|dkrn|S(Ntdirit*(RRtisdirR_R!RR=(R,RCRIttt constructortapp((s3/usr/lib/python2.7/site-packages/paste/urlparser.pyRMs !  cCs|j}|||(RqRRRthextabstid(R,((s3/usr/lib/python2.7/site-packages/paste/urlparser.pyt__repr__Ns  N(RRt__doc__RoRR9RR=R2RKR>RAR;RLRMRnt classmethodRsR:Ry(((s3/usr/lib/python2.7/site-packages/paste/urlparser.pyR s&2 1 0    #     cCsO|d}|r-|dtjj|7}ntjj|}|j||S(Ns paste.urlparser.base_python_namet.(RRtbasenameRs(RrRCRIR((s3/usr/lib/python2.7/site-packages/paste/urlparser.pytmake_directoryUs  RecCs tj|S(N(RtFileApp(RrRCRI((s3/usr/lib/python2.7/site-packages/paste/urlparser.pyt make_unknown_sRfcCsZ|d}tjjtjj|d}|rC|d|}nt||||dS(Ns paste.urlparser.base_python_nameiR|s wsgi.errors(RRR_R}tload_module_from_name(RCRIRt module_name((s3/usr/lib/python2.7/site-packages/paste/urlparser.pyRuds  " cCstjj|rtj|Stjjtjj|d}tjj|syt|d}Wn=t t fk r}|j dtjj||fdSX|j d|j nd}tjj|rtj|Sd|kr?dj|jdd }|jdd} t|tjj|||} n|} d}zFtj| tjj|g\}} } tj||| | } Wd|dk r|j nX| S(Ns __init__.pytws5Cannot write __init__.py file into directory %s (%s) s# R|i(tsystmodulesthas_keyRRR@tdirnameRttopentOSErrortIOErrorRBR=tclosetsplitRtimpt find_moduleRu(RCRIRterrorst init_filenametftetfpt parent_namet base_nametparenttpathnametstufftmodule((s3/usr/lib/python2.7/site-packages/paste/urlparser.pyRls< !    $ cCst||}|sdSt|drG|jrGt|jd|jS|jjdd}t||rt||}t|dr|jSt||Sn|djd||fdS(NRHRSR|is wsgi.errorss'Cound not find application or %s in %s ( RuR=thasattrRHR<RRRSRB(RrRCRIRRtobj((s3/usr/lib/python2.7/site-packages/paste/urlparser.pytmake_pys s.pycBskeZdZd d dZdZeeZdZdZdZ d dZ dZ dZ RS( s Like ``URLParser`` but only serves static files. ``cache_max_age``: integer specifies Cache-Control max_age in seconds cCs7|j||_|j|p!||_||_dS(N(tnormpathRtroot_directoryt cache_max_age(R,RRR((s3/usr/lib/python2.7/site-packages/paste/urlparser.pyR2scCstjjtjj|S(N(RRtnormcasetabspath(R((s3/usr/lib/python2.7/site-packages/paste/urlparser.pyRsc Cs|jdd}|s(|j||S|dkr=d}ntj|}|jtjj|j|}|j |j s|j ||Stjj |s|j ||Stjj |r|j|d|j d|j||S|jdr|jddkr|j||S|jd}|rtj|j}t||krg}tj|||d|dgSn|j|} |jr| jd |jn| ||S( NR3R4R s index.htmlRRtHTTP_IF_NONE_MATCHs304 Not Modifiedtmax_age(RR;Rt path_info_popRRRR@RR$RRARtRgRqRterror_extra_pathtstattst_mtimeR)RR"tmake_appt cache_control( R,RCRDRERItfullt if_none_matchtmytimeRYtfa((s3/usr/lib/python2.7/site-packages/paste/urlparser.pyRKs:  ! $   cCs tj|S(N(RR(R,RI((s3/usr/lib/python2.7/site-packages/paste/urlparser.pyRscCsutj|dt}|d7}|jdrC|d|d7}ntjd|dd|fg}|j||S(s^ This happens when you try to get to a directory without a trailing / RVR RWRXsFThe resource has moved to %s - you should be redirected automatically.RYRZ(RRRR[RRR\RS(R,RCRDR]RU((s3/usr/lib/python2.7/site-packages/paste/urlparser.pyR;s c Cs]tjdtj|dd|jd|jd|j|pCdf}|j||S(Ns%The resource at %s could not be foundRPs6SCRIPT_NAME=%r; PATH_INFO=%r; looking in %r; debug: %sR6R3s(none)(RRQRRRRRRS(R,RCRDRTRU((s3/usr/lib/python2.7/site-packages/paste/urlparser.pyRAscCs'tjd|d}|j||S(Ns#The trailing path %r is not allowedR3(RRQRS(R,RCRDRU((s3/usr/lib/python2.7/site-packages/paste/urlparser.pyRscCsd|jj|jfS(Ns<%s %r>(RqRR(R,((s3/usr/lib/python2.7/site-packages/paste/urlparser.pyRysN( RRRzR=R2Rt staticmethodRKRR;RARRy(((s3/usr/lib/python2.7/site-packages/paste/urlparser.pyR s    &   cCs+|dk rt|}nt|d|S(s Return a WSGI application that serves a directory (configured with document_root) cache_max_age - integer specifies CACHE_CONTROL max_age in seconds RN(R=tintR (R-t document_rootR((s3/usr/lib/python2.7/site-packages/paste/urlparser.pyt make_statics cBs5eZdddZdZdZddZRS(cCstdkrtdnt|ttfrEtj||_n ||_||_|dkrrtj }n||_ |dkr|}nt j j ||_dS(Ns"This class requires pkg_resources.(t pkg_resourcesR=tNotImplementedErrorR(R)R*tget_distributionteggt resource_nametResourceManagertmanagerRRRt root_resource(R,t egg_or_specRRR((s3/usr/lib/python2.7/site-packages/paste/urlparser.pyR2 s       cCs d|jj|jj|jfS(Ns<%s for %s:%r>(RqRRt project_nameR(R,((s3/usr/lib/python2.7/site-packages/paste/urlparser.pyRys  c Cs|jdd}|s(|j||S|dkr=d}ntj|}tjjtjj|jd|}|j dk r|j |j  r|j ||S|j j|s|j ||S|j j|r$|j dk r|j p|j}|j|j ||jd|||S|jdrX|jddkrX|j||Stj|\}}|s|d}ny|j j|j|} Wn9ttfk r} tjd| } | j||SX|dd |fgtj| S( NR3R4R s index.htmlRsapplication/octet-streams,You are not permitted to view this file (%s)s200 OKs content-type(RR;RRRRRRRRR=R$RARt has_resourcetresource_isdirRqRRt mimetypest guess_typetget_resource_streamRRRt HTTPForbiddenRSRt _FileIter( R,RCRDRERItresourcet child_rootttypetencodingtfileRRU((s3/usr/lib/python2.7/site-packages/paste/urlparser.pyRK"s>  " $  c Csctjdtj|dd|jd|jd|j|j|pIdf}|j||S(Ns%The resource at %s could not be foundRPs=SCRIPT_NAME=%r; PATH_INFO=%r; looking in egg:%s#%r; debug: %sR6R3s(none)(RRQRRRRRRRS(R,RCRDRTRU((s3/usr/lib/python2.7/site-packages/paste/urlparser.pyRAIsN(RRR=R2RyRKRA(((s3/usr/lib/python2.7/site-packages/paste/urlparser.pyR s  'R4cCs(tdkrtdnt||S(s A static file parser that loads data from an egg using ``pkg_resources``. Takes a configuration value ``egg``, which is an egg spec, and a base ``resource_name`` (default empty string) which is the path in the egg that this starts at. s%This function requires pkg_resources.N(RR=RR (R-RR((s3/usr/lib/python2.7/site-packages/paste/urlparser.pytmake_pkg_resourcesRs c Ks|d kr!|jdd }ntj|}|d krQ|jdd }ntj|}|d kr|jd d}ntj|}ti||d|d|d ||S(s Create a URLParser application that looks in ``directory``, which should be the directory for the Python package named in ``base_python_name``. ``index_names`` are used when viewing the directory (like ``'index'`` for ``'index.html'``). ``hide_extensions`` are extensions that are not viewable (like ``'.pyc'``) and ``ignore_extensions`` are viewable but only if an explicit extension is given. R RRRRRs.pyctbakspy~RN(sindexsIndexsmainsMain(s.pycRspy~((R=RRRR (R-RRR RRR.((s3/usr/lib/python2.7/site-packages/paste/urlparser.pytmake_url_parser]s"   ( RzRRRRRt ImportErrorR=tpasteRRt paste.utilRRt httpheadersRRtobjectRt__all__R R~RnRRuRRR RR RR(((s3/usr/lib/python2.7/site-packages/paste/urlparser.pyts@      ;    " \ G