m -Ec@sdZddd!ZdkZdkZdkZdkZdkZdkZdkl Z l Z dk l Z dk l Z lZdklZd klZlZlZd klZe d d Zd ZdZhdd<dd<dd<dd<dd<dd<dd<dd<dd <d!d"<d#d$<d%d&<d'd(<d)d*<d+d,<d-d.<d/d0<d1d2<d3d4<d5d6<d7d8<d9d:<d;d<<d=d><d?d@<dAdB<dCdD<dEdF<dGdH<dIdJ<dKdL<dMdN<dOdP<dQdR<dSdT<dUdV<dWdX<dYdZ<d[d\<d]d^<d_d`<dadb<dcdd<dedf<dgdh<didj^st nameerrortkeyerrortredirecttresourcelockederrors (]*>)s set-cookieis timagetDONT_GZIP_MAJOR_MIME_TYPESt,t HTTPResponsecBs;tZdZdZdZdZdZdZdZdZ dde e i e i dZdZe ZddZd Ze e d Zdd Zd ZeZddeid ieideiie dZhddddZeidddeidZdZ eideiidZ!dZ"dZ#dZ$ddZ%dZ&dZ'dd Z(d!dd"Z)d#Z*d$Z+d%d&Z,e,Z-d'Z.d(Z/d)Z0d*Z1de eid+ieid,idd-Z2e Z3d.Z4eid/eiid0Z5d1Z6RS(2su An object representation of an HTTP response. The Response type encapsulates all possible responses to HTTP requests. Responses are normally created by the object publisher. A published object may recieve the response abject as an argument named 'RESPONSE'. A published object may also create it's own response object. Normally, published objects use response objects to: - Provide specific control over output headers, - Set cookies, or - Provide stream-oriented output. If stream oriented output is used, then the response object passed into the object must be used. R tZopes text/htmliicCs|djo h}n||_|djo d|_d|_d|d((RRs& #      cCswt|}t|}|i}t|o!d|i||f|_dSn|o|p|}||i |$stext/html(\s*;\s*charset=((latin)|(latin[-_]?1)|(cp1252)|(cp819)|(csISOLatin1)|(IBM819)|(iso-ir-100)|(iso[-_]8859[-_]1(:1987)?)))?$cCs4|iodSn|o d|_n|p|Snt|to#t|djo|\}}nt|tp$t |do|i }qnt|t o|i |}nPt|ton<yt|}Wn(t j o|i t |}nXt|}|djoV|d djoE|id|djo+||dj o|i|dd!nV|oEt|}|p|i|||_q|i|||_n ||_|i|i} |iid p3| od t} n d t} |id | nO|id } | id o1d | jo$d| tf} |id | n|id } | djp|| dj o4di|i d}di|i d}n|idt|i|i!|i"o*|ii#dddjo| i ddt$jo|i}t|} t&i'dt&i(t&i) t&i*d}t,|i-||i.t/i0dt&i1|| g} di| }t|}|| joQ||_|id||idd|i"djo|i5ddq(q,q0n|S(s  Set the body of the response Sets the return body equal to the (string) argument "body". Also updates the "content-length" return header. You can also specify a title, in which case the title and body will be wrapped up in html, head, title, and body tags. If the body is a 2-element tuple, then it will be treated as (title,body) If is_error is true then the HTML will be formatted as a Zope error message instead of a generic HTML page. NiitasHTMLitis content-typestext/html; charset=%sstext/plain; charset=%sstext/scharset=s%s; charset=%ss text/htmls<ss>sscontent-lengthscontent-encodingtgzipt/iisR R1ttupletlenttitleR7thasattrRFtunicodet_encode_unicodet UnicodeErrortltfindtbogus_str_searchRt notFoundErrortis_errort_htmlt _error_htmltisHTMLRR:tdefault_encodingtcR=t startswitht content_typetlatin1_alias_matchtjointsplitt insertBasetuse_HTTP_content_compressiontgettuncompressableMimeMajorTypeststartlentzlibt compressobjtDEFLATEDt MAX_WBITSt DEF_MEM_LEVELtcot _gzip_headertcompresstflushtstructtpacktcrc32tchunkstztnewlent appendHeader(RR RORXRVR`R>RmRvRtRgR_R]R[RTRu((RR!sz  # K       &  9    cCsw|o |iSn_|o d|_nK|p"|iddiddjo!|o d|_qpd|_n|iS( sgEnable HTTP Content Encoding with gzip compression if possible REQUEST -- used to check if client can accept compression force -- set true to ignore REQUEST headers disable -- set true to disable compression query -- just return if compression has been previously requested returns -- 1 if compression will be attempted, 2 if compression is forced, 0 if no compression The HTTP specification allows for transfer encoding and content encoding. Unfortunately many web browsers still do not support transfer encoding, but they all seem to support content encoding. This function is designed to be called on each request to specify on a request-by-request basis that the response content should be compressed. This is quite useful for xml-rpc transactions, where compression rates of 90% or more can be achieved for text data. The REQUEST headers are used to determine if the client accepts gzip content encoding. The force parameter can force the use of gzip encoding regardless of REQUEST, and the disable parameter can be used to "turn off" previously enabled encoding (but note that any existing content-encoding header will not be changed). The query parameter can be used to determine the if compression has been previously requested. In setBody, the major mime type is used to determine if content encoding should actually be performed. By default, image types are not compressed. Additional major mime types can be specified by setting the environment variable DONT_GZIP_MAJOR_MIME_TYPES to a comma-seperated list of major mime types that should also not be gzip compressed. itHTTP_ACCEPT_ENCODINGR RIiiiN(tqueryRRdtdisabletforcetREQUESTReRU(RR|R{RzRy((RtenableHTTPCompressions#  )  s'(?:application|text)/[-+0-9a-z]+\s*;\s*scharset=([-_0-9a-z]+s)(?:(?:\s*;)|\Z)cCsd}|iido|i|id}|o5|id}|i |}|||}|Sq|id}|i dp|i dod|t f|ids$iN(R R^RUt pos_righttencoding(R RR~((Rtfix_xml_preambles s content-typeistext/s application/s%s; charset=%streplace( RRRR:t charset_retmatchtgroupRR tencodetctR^R\(RR RRRRR((RRRs   cCsH|djo d}n|idp|d}nt||_dS(stSet the base URL for the returned document. If base is None, or the document already has a base, do nothing.R RJN(RRtendswithR7R(RR((RtsetBases   s ()cCs|iiddidd}|o|djodSn|io|i}|ot|}|dj o|i dt |i d}||}|djoGd|| t|id||f|_|idt |iqqqndS( Ns content-typeR t;is text/htmls%s %siscontent-length(RRReRbR_RR tstart_of_header_searchRRtstartRNRtindextbase_re_searchtibasetescapeR=(RRR RRR_R((RRcs"    "  *cCst|}t|}|i}|i|o||}nh}||<|idod|d|f|disR0(RRRR>((RR^s   cCsd||fS(NsB %s %s (ROR (RROR ((RRYmscCsd||fdS(Ns}

Site Error

An error was encountered while publishing this resource.

%s

%ss

Troubleshooting Suggestions

  • The URL may be incorrect.
  • The parameters passed to this resource may be incorrect.
  • A resource that this resource relies on may be encountering an error.

For more detailed information about the error, please refer to the error log.

If the error persists please contact the site maintainer. Thank you for your patience.

(ROR (RROR ((RRZssR.cCs8|idt|iddddt|dS(NisResource not founds-Sorry, the requested resource does not exist.s#

Check the URL and try again.

s

Resource: %s

(RRtNotFoundRZRtentry(RR((RRWs  cCst|idd|dS(NsDebugging Notices@Zope has encountered a problem publishing your object.

%s

(RRRZR(RR((Rt debugErrors cCsb|idtid|ot|iddnt|idd|ddd dS( Nis ^[A-Z_0-9]+$sInternal Errors3Sorry, an internal error occurred in this resource.sInvalid requestsThe parameter, %s, s was omitted from the request.

s.Make sure to specify all required parameters, sand try the request again.

(RRtreRR?t InternalErrorRZt BadRequest(RR?((RtbadRequestErrors     cCs/|i}|o|idd|dndS(NsWWW-Authenticatesbasic realm="%s"i(RtrealmR=(RR((Rt _unauthorizeds cCsM|id}|io&|io|d}q@|d}nt|dS(Ns@You are not authorized to access this resource.s.

Username and password are not correct.

s&

No Authorization header found.

(RRtmt debug_modet_authR(RR((Rt unauthorizeds   s \w+://[\w\.]+s [a-zA-Z]>cCst|tfjo&t|djo|\}}} nti\}}} |djp0|tjp#t |t i o$t |tod}|in| }ytt|t}|id|d} |id| x| idj o | i} qWt| i}t| iii}|iti d}|id||id|WnnX|} ~|i!||i"d job|i"d joRt |toR||dj o?|i"d jo|i!d n|id |d} |Sqt |t$oS|i"d jo|i!d n|id |i%d |i&dd} |Sqy|\}} t |to_||dj oL|i"d jo|i!d n|id ||i&| d} |SnWqqXn|} t | t)o1yt| } Wq>dt| i*} q>Xn|oY|t,joL|i-d jo<|i&t|d|i.||| dfdd} n y|| } Wnt2j o d} nX| djo<|i&t|d|i.||| dfdd} n|i3| oLt4o,|i&| |i.|d| dd} q|i&| dd} n8|i&t|| |i.|d| d fdd} ~ | S(NiRsbobo-exception-types$See the server error log for detailssbobo-exception-valueisbobo-exception-filesbobo-exception-linei,ii.RiR ssZope has exited normally.

s

RXis Sorry, a site error occurred.

s (see above)(5ttypetinfoRNRRRtsystexc_infoRR1R2R3R4RRtstbt translateR7tnl2sptetR=tevttb_nextRt tb_linenotelttb_frametf_codet co_filenametefRbtostsepRRt absuri_matchtRedirecttargsR!RTtbR5R6tfatalt SystemExittcodeRR t tag_searchRt TypeErrorR[tAPPEND_TRACEBACKS(RRRRRtabortRRRRRRR RRRTRR((Rt exceptions,=  #  #  $,  ,+ cCs;g}x.|iiD]\}}d||df}x|iD]\}}|i}|djod||f}qC|djod||f}qC|djod||f}qC|d jod ||f}qC|d jod ||f}qC|d jo|od|}qCqCW|i |qW|S(NsSet-Cookie: %s="%s"R@Rs%s; Expires=%stdomains %s; Domain=%stpaths %s; Path=%sRs%s; Max-Age=%stcomments%s; Comment=%stsecures %s; Secure( t cookie_listRR"RR?tattrsRRR8tappend(RR?RRRR((Rt _cookie_list5s*        sc Cs|iodSn|i}|i}|id o+|id o|idt|ng}|i} | d|i dd| d|ido |d=nx|i D]\}}|i |jod|d i|d f}d }|id |}xf||joTd || ||d |d !i||d f}|d }|id |}qWn| d||fqW|io||i}n|i|g|t|)di|S(NR scontent-lengthstransfer-encodings Status: %sRs200 OKs:X-Powered-By: Zope (www.zope.org), Python (www.python.org)s%s%siit-s%s-%s%sis%s: %ss (Rt_wroteRR R:R=RNtheaderslRReRRAtvalR8tupperRRURTR"RRCRa( Rt html_searchR RRRRTRARR((Rt__str__Rs8   "     4  cCsB|ip$|id|_|iin|ii|dS(s Return data as a stream HTML data may be returned using a stream-oriented interface. This allows the browser to display partial results while computation of a response to proceed. The published object should first set any output headers or cookies on the response object. Note that published objects must not generate any errors after beginning stream-oriented output. iN(RRt outputBodyR#Rptwritetdata(RR((RRws    (7R6t __module__t__doc__RCR Rt _error_formatR0RLRdRRR#R$R%R'R+R,R-RR=REt __setitem__RtcompiletsearchtIRR!R}t IGNORECASERRRRcRRRRwR[RRRRYRZRWtforbiddenErrorRRRRRRRRR(((RR~sZ    '  p5              0s %(5Rt __version__R2RRRRhRqtstringRt maketranst BaseResponset zExceptionsRRtzExceptions.ExceptionFormatterRt ZPublisherRRRtcgiRRR\RR<R9RRARRaRbR8R7tfiltertdirt __builtins__tenR?RRRRR:RBRnRftenvironRet otherTypesRMR( RRRR\RRRRBRqRRR?RRRRnRR<RRAR2RRRRRRhRRRfR9R((Rt?sJ $   1 "