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@sdZddlZddlZddlmZddlmZddlmZm Z m Z m Z ddl m Z mZddlmZddlmZdd lmZdd lmZdd lmZd d gZejdejZdefdYZedeZde fdYZ!d e fdYZ"d e fdYZ#i*dd6dd6dd6dd6dd6d d!6d"d#6d$d%6d&d'6d(d)6d*d+6d,d-6d.d/6d0d16d2d36d4d56d6d76d8d96d:d;6d<d=6d>d?6d@dA6dBdC6dDdE6dFdG6dHdI6dJdK6dLdM6dNdO6dPdQ6dRdS6dTdU6dVdW6dXdY6dZd[6d\d]6d^d_6d`da6dbdc6ddde6dfdg6dhdi6Z$dS(jsWSGI Wrappers for a Request and Response The WSGIRequest and WSGIResponse objects are light wrappers to make it easier to deal with an incoming request and sending a response. iN(tpformat(t SimpleCookie(tEnvironHeaderstget_cookie_dicttparse_dict_querystringtparse_formvars(t MultiDicttUnicodeMultiDict(tStackedObjectProxy(t HeaderDict(tencode_unicode_app_iter(tACCEPT_LANGUAGE(tdesired_matchest WSGIRequestt WSGIResponses;\s*charset=([^;]*)tDeprecatedSettingscBseZdZRS(cCs7tjdtdtjj|tj||dS(Nsepaste.wsgiwrappers.settings is deprecated: Please use paste.wsgiwrappers.WSGIRequest.defaults insteadi(twarningstwarntDeprecationWarningRtdefaultst _push_objectR(tselftobj((s6/usr/lib/python2.7/site-packages/paste/wsgiwrappers.pyRs  (t__name__t __module__R(((s6/usr/lib/python2.7/site-packages/paste/wsgiwrappers.pyRstdefaulttenviron_gettercBs2eZdZdddZddZdZRS(s5For delegating an attribute to a key in self.environ.tcCs||_||_||_dS(N(tkeyRtdefault_factory(RRRR((s6/usr/lib/python2.7/site-packages/paste/wsgiwrappers.pyt__init__'s  cCsa|dkr|S|j|jkrS|jrI|j}|j|j<|S|jSn|j|jS(N(tNoneRtenvironRR(RRttypetval((s6/usr/lib/python2.7/site-packages/paste/wsgiwrappers.pyt__get__+s   cCs d|jS(Ns(R(R((s6/usr/lib/python2.7/site-packages/paste/wsgiwrappers.pyt__repr__6sN(RRt__doc__RRR#R$(((s6/usr/lib/python2.7/site-packages/paste/wsgiwrappers.pyR$s c BseZdZededddddeddZdZe d Z e d Z e d Z e d Z e d ZdZeedejZdZeedejZdZeedejZdZeedejZdZdZeedejZdZdZeedejZdZeedejZdZeedejZdZdZdZRS(s#WSGI Request API Object This object represents a WSGI request with a more friendly interface. This does not expose every detail of the WSGI environment, and attempts to express nothing beyond what is available in the environment dictionary. The only state maintained in this object is the desired ``charset``, its associated ``errors`` handler, and the ``decode_param_names`` option. The incoming parameter values will be automatically coerced to unicode objects of the ``charset`` encoding when ``charset`` is set. The incoming parameter names are not decoded to unicode unless the ``decode_param_names`` option is enabled. When unicode is expected, ``charset`` will overridden by the the value of the ``Content-Type`` header's charset parameter if one was specified by the client. The class variable ``defaults`` specifies default values for ``charset``, ``errors``, and ``langauge``. These can be overridden for the current request via the registry. The ``language`` default value is considered the fallback during i18n translations to ensure in odd cases that mixed languages don't occur should the ``language`` file contain the string but not another language in the accepted languages list. The ``language`` value only applies when getting a list of accepted languages from the HTTP Accept header. This behavior is duplicated from Aquarium, and may seem strange but is very useful. Normally, everything in the code is in "en-us". However, the "en-us" translation catalog is usually empty. If the user requests ``["en-us", "zh-cn"]`` and a translation isn't found for a string in "en-us", you don't want gettext to fallback to "zh-cn". You want it to just use the string itself. Hence, if a string isn't found in the ``language`` catalog, the string in the source code will be used. *All* other state is kept in the environment dictionary; this is essential for interoperability. You are free to subclass this object. Rtcharsetterrorstreplacetdecode_param_namestlanguagesen-uscCs||_t||_|jj}|jd|_|jrc|j}|rc||_qcn|jdd|_|jdt |_ d|_ dS(NR&R'tstrictR)( R RtheadersRt _current_objtgetR&tdetermine_browser_charsetR'tFalseR)Rt _languages(RR Rtbrowser_charset((s6/usr/lib/python2.7/site-packages/paste/wsgiwrappers.pyRis   s wsgi.inputswsgi.url_schemetREQUEST_METHODt SCRIPT_NAMEt PATH_INFOcCs@d|jkr|jdSd|jkr8|jddSiSdS(sc Return any variables matched in the URL (e.g., ``wsgiorg.routing_args``). s paste.urlvarsswsgiorg.routing_argsiN(R (R((s6/usr/lib/python2.7/site-packages/paste/wsgiwrappers.pyturlvarss  tdoccCs|jjdddkS(sEReturns a boolean if X-Requested-With is present and a XMLHttpRequesttHTTP_X_REQUESTED_WITHRtXMLHttpRequest(R R.(R((s6/usr/lib/python2.7/site-packages/paste/wsgiwrappers.pytis_xhrscCs|jjd|jjdS(s>Host name provided in HTTP_HOST, with fall-back to SERVER_NAMEt HTTP_HOSTt SERVER_NAME(R R.(R((s6/usr/lib/python2.7/site-packages/paste/wsgiwrappers.pythostscCs|jdk r|jS|jjd}tj|j}|jjdd}|sY|S||kru|j|n|j|}g||d)||_|jS(slReturn a list of preferred languages, most preferred first. The list may be empty. tHTTP_ACCEPT_LANGUAGER*sen-usiN( R1RR R.R tparseRtappendtindex(RtacceptLanguagetlangstfallbackRA((s6/usr/lib/python2.7/site-packages/paste/wsgiwrappers.pyt languagess  cCs t|jS(N(RR (R((s6/usr/lib/python2.7/site-packages/paste/wsgiwrappers.pyt_GETscCsC|j}|jr?t|d|jd|jd|j}n|S(s Dictionary-like object representing the QUERY_STRING parameters. Always present, if possibly empty. If the same key is present in the query string multiple times, a list of its values can be retrieved from the ``MultiDict`` via the ``getall`` method. Returns a ``MultiDict`` container or a ``UnicodeMultiDict`` when ``charset`` is set. tencodingR't decode_keys(RFR&RR'R)(Rtparams((s6/usr/lib/python2.7/site-packages/paste/wsgiwrappers.pytGETs   cCst|jdtS(Ntinclude_get_vars(RR R0(R((s6/usr/lib/python2.7/site-packages/paste/wsgiwrappers.pyt_POSTscCsC|j}|jr?t|d|jd|jd|j}n|S(skDictionary-like object representing the POST body. Most values are encoded strings, or unicode strings when ``charset`` is set. There may also be FieldStorage objects representing file uploads. If this is not a POST request, or the body is not encoded fields (e.g., an XMLRPC request) then this will be empty. This will consume wsgi.input when first accessed if applicable, but the raw version will be put in environ['paste.parsed_formvars']. Returns a ``MultiDict`` container or a ``UnicodeMultiDict`` when ``charset`` is set. RGR'RH(RLR&RR'R)(RRI((s6/usr/lib/python2.7/site-packages/paste/wsgiwrappers.pytPOSTs    cCsft}|j|j|j|j|jrbt|d|jd|jd|j}n|S(sDictionary-like object of keys from POST, GET, URL dicts Return a key value from the parameters, they are checked in the following order: POST, GET, URL Additional methods supported: ``getlist(key)`` Returns a list of all the values by that key, collected from POST, GET, URL dicts Returns a ``MultiDict`` container or a ``UnicodeMultiDict`` when ``charset`` is set. RGR'RH(RtupdateRLRFR&RR'R)(RRI((s6/usr/lib/python2.7/site-packages/paste/wsgiwrappers.pyRIs   cCs t|jS(szDictionary of cookies keyed by cookie name. Just a plain dictionary, may be empty but not None. (RR (R((s6/usr/lib/python2.7/site-packages/paste/wsgiwrappers.pytcookiesscCs5tj|jjdd}|r1|jdSdS(s Determine the encoding as specified by the browser via the Content-Type's charset parameter, if one is set s Content-TypeRiN(t _CHARSET_REtsearchR,R.tgroup(Rt charset_match((s6/usr/lib/python2.7/site-packages/paste/wsgiwrappers.pyR/scCst||jjddS(sqReturn a list of specified mime-types that the browser's HTTP Accept header allows in the order provided.t HTTP_ACCEPTs*/*(R R R.(Rt mimetypes((s6/usr/lib/python2.7/site-packages/paste/wsgiwrappers.pyt match_acceptscCst}d|jj|jjt|||jf}|d||j||j||j||j f7}|d||j 7}|j r|d||j ||j f7}n|d||j 7}|d||j7}|d||j7}|S(s,Show important attributes of the WSGIRequests <%s.%s object at 0x%x method=%s,s2 scheme=%s, host=%s, script_name=%s, path_info=%s,s languages=%s,s charset=%s, errors=%s,s GET=%s,s POST=%s,s cookies=%s>(Rt __class__RRtidtmethodtschemeR=t script_namet path_infoRER&R'RJRMRO(Rtpftmsg((s6/usr/lib/python2.7/site-packages/paste/wsgiwrappers.pyR$s$ N(RRR%RtdictRR0RRRtbodyRZRYR[R\R6tpropertyR:R=RERFRJRLRMRIROR/RVR$(((s6/usr/lib/python2.7/site-packages/paste/wsgiwrappers.pyR 9s>,                  c Bs\eZdZededddddddid d 6Zd d$d d ZdZdZ dZ dZ d d$d$dd$d$d$dZ dd$dZ dZededdZdZdZdZdZdZdZdZd ZeeeedejZd!Zd"Zd#ZeeeedejZRS(%sA basic HTTP response with content, headers, and out-bound cookies The class variable ``defaults`` specifies default values for ``content_type``, ``charset`` and ``errors``. These can be overridden for the current request via the registry. Rt content_types text/htmlR&sutf-8R'R+R,sno-caches Cache-ControlRicCsd|_t|_||_t|_t|_||_ |j j }|s|j dd}|j d}|rd||f}qn|jj |j di||jd<|j dd|_dS( NRbs text/htmlR&s%s; charset=%sR,s Content-TypeR'R+(Rt_itertTruet _is_str_itertcontentR R,RROt status_codeRR-R.RNR'(RRftmimetypetcodeRR&((s6/usr/lib/python2.7/site-packages/paste/wsgiwrappers.pyR,s       cCsq|jr!dj|j}nt|j}djg|jjD]\}}d||f^qFd|S(sReturns a rendition of the full HTTP message, including headers. When the content is an iterator, the actual content is replaced with the output of str(iterator) (to avoid exhausting the iterator). Rs s%s: %ss (Retjoint get_contenttstrRfR,t headeritems(RRfRtvalue((s6/usr/lib/python2.7/site-packages/paste/wsgiwrappers.pyt__str__?s cstj}dj|f}jj}x6jjD]%}|jd|jddfq?W|||tj t }d|kr|r|dj S|rt fddSj S(sConvenience call to return output and set status information Conforms to the WSGI interface for calling purposes only. Example usage: .. code-block:: python def wsgi_app(environ, start_response): response = WSGIResponse() response.write("Hello world") response.headers['Content-Type'] = 'latin1' return response(environ, start_response) s%s %ss Set-CookietheaderRswsgi.file_wrappercs jjS(N(Rftread((R(s6/usr/lib/python2.7/site-packages/paste/wsgiwrappers.pytgs( tSTATUS_CODE_TEXTRgR,RmROtvaluesR@toutputt isinstanceRftfiletiterRk(RR tstart_responset status_texttstatustresponse_headerstctis_file((Rs6/usr/lib/python2.7/site-packages/paste/wsgiwrappers.pyt__call__Ms # cCs5tj|jjdd}|r1|jdSdS(st Determine the encoding as specified by the Content-Type's charset parameter, if one is set s Content-TypeRiN(RPRQR,R.RR(RRS((s6/usr/lib/python2.7/site-packages/paste/wsgiwrappers.pytdetermine_charsetjscCs#tjdtd|jj|S(s5 Case-insensitive check for a header sOWSGIResponse.has_header is deprecated, use WSGIResponse.headers.has_key insteadi(RRRR,thas_key(RRp((s6/usr/lib/python2.7/site-packages/paste/wsgiwrappers.pyt has_headerss t/c Cs||j||jdSdS(s; Get/set the charset (in the Content-Type) s content-typeiN(R,R.RRPRQRR(RRptmatch((s6/usr/lib/python2.7/site-packages/paste/wsgiwrappers.pyt charset__gets cCs|dkr|`dSy|jjd}Wntk rKtdnXtj|}|r||j ||j }n|d|7}||jdsz  "