JFIF  x x C         C     "        } !1AQa "q2 #B R $3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz        w !1AQ aq"2 B #3R br $4 % &'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz   ?  N m? j EP ó Åßjc @sädZddlZyddlmZmZWn'ek rUddlmZmZnXddlZddlZdddddd gZ d j Z d j Z d j Z defd „ƒYZejdƒZd„ZejejdZi¥dd6dd6dd6dd6dd6dd6dd6dd 6d!d"6d#d$6d%d&6d'd(6d)d*6d+d,6d-d.6d/d06d1d26d3d46d5d66d7d86d9d:6d;d<6d=d>6d?d@6dAdB6dCdD6dEdF6dGdH6dIdJ6dKdL6dMdN6dOdP6dQdR6dSdT6dUdV6dWdX6dYdZ6d[d\6d]d^6d_d`6dadb6dcdd6dedf6dgdh6didj6dkdl6dmdn6dodp6dqdr6dsdt6dudv6dwdx6dydz6d{d|6d}d~6dd€6d�d‚6dƒd„6d…d†6d‡dˆ6d‰dŠ6d‹dŒ6d�dŽ6d�d�6d‘d’6d“d”6d•d–6d—d˜6d™dš6d›dœ6d�dž6dŸd 6d¡d¢6d£d¤6d¥d¦6d§d¨6d©dª6d«d¬6d­d®6d¯d°6d±d²6d³d´6dµd¶6d·d¸6d¹dº6d»d¼6d½d¾6d¿dÀ6dÁdÂ6dÃdÄ6dÅdÆ6dÇdÈ6dÉdÊ6dËdÌ6dÍdÎ6dÏdÐ6dÑdÒ6dÓdÔ6dÕdÖ6d×dØ6dÙdÚ6dÛdÜ6dÝdÞ6dßdà6dádâ6dãdä6dådæ6dçdè6dédê6dëdì6dídî6dïdð6dñdò6dódô6dõdö6d÷dø6dùdú6dûdü6dýdþ6dÿd6dd6dd6dd6dd6d d 6d d 6d d6dd6dd6dd6dd6dd6dd6dd6dd6dd 6d!d"6d#d$6d%d&6d'd(6d)d*6d+d,6d-d.6d/d06d1d26d3d46d5d66d7d86d9d:6d;d<6d=d>6d?d@6dAdB6dCdD6dEdF6dGdH6dIdJ6dKdL6dMdN6dOdP6dQdR6dSdT6dUdV6dWdX6dYdZ6Zd j d[„ed\ƒDƒƒZeeejd]„Zejd^ƒjZd_„Zd`„ZdadbdcdddedfdggZddhdidjdkdldmdndodpdqdrdsg Z!dtee!du„Z"dve#fdw„ƒYZ$dxZ%e%dyZ&ejdze%d{e&d|ƒZ'de#fd}„ƒYZ(de(fd~„ƒYZ)de(fd„ƒYZ*de(fd€„ƒYZ+e+Z,d�„Z-e.d‚kràe-ƒndS(ƒs  Here's a sample session to show how to use this module. At the moment, this is the only documentation. The Basics ---------- Importing is easy.. >>> import Cookie Most of the time you start by creating a cookie. Cookies come in three flavors, each with slightly different encoding semantics, but more on that later. >>> C = Cookie.SimpleCookie() >>> C = Cookie.SerialCookie() >>> C = Cookie.SmartCookie() [Note: Long-time users of Cookie.py will remember using Cookie.Cookie() to create a Cookie object. Although deprecated, it is still supported by the code. See the Backward Compatibility notes for more information.] Once you've created your Cookie, you can add values just as if it were a dictionary. >>> C = Cookie.SmartCookie() >>> C["fig"] = "newton" >>> C["sugar"] = "wafer" >>> C.output() 'Set-Cookie: fig=newton\r\nSet-Cookie: sugar=wafer' Notice that the printable representation of a Cookie is the appropriate format for a Set-Cookie: header. This is the default behavior. You can change the header and printed attributes by using the .output() function >>> C = Cookie.SmartCookie() >>> C["rocky"] = "road" >>> C["rocky"]["path"] = "/cookie" >>> print C.output(header="Cookie:") Cookie: rocky=road; Path=/cookie >>> print C.output(attrs=[], header="Cookie:") Cookie: rocky=road The load() method of a Cookie extracts cookies from a string. In a CGI script, you would use this method to extract the cookies from the HTTP_COOKIE environment variable. >>> C = Cookie.SmartCookie() >>> C.load("chips=ahoy; vienna=finger") >>> C.output() 'Set-Cookie: chips=ahoy\r\nSet-Cookie: vienna=finger' The load() method is darn-tootin smart about identifying cookies within a string. Escaped quotation marks, nested semicolons, and other such trickeries do not confuse it. >>> C = Cookie.SmartCookie() >>> C.load('keebler="E=everybody; L=\\"Loves\\"; fudge=;";') >>> print C Set-Cookie: keebler="E=everybody; L=\"Loves\"; fudge=;" Each element of the Cookie also supports all of the RFC 2109 Cookie attributes. Here's an example which sets the Path attribute. >>> C = Cookie.SmartCookie() >>> C["oreo"] = "doublestuff" >>> C["oreo"]["path"] = "/" >>> print C Set-Cookie: oreo=doublestuff; Path=/ Each dictionary element has a 'value' attribute, which gives you back the value associated with the key. >>> C = Cookie.SmartCookie() >>> C["twix"] = "none for you" >>> C["twix"].value 'none for you' A Bit More Advanced ------------------- As mentioned before, there are three different flavors of Cookie objects, each with different encoding/decoding semantics. This section briefly discusses the differences. SimpleCookie The SimpleCookie expects that all values should be standard strings. Just to be sure, SimpleCookie invokes the str() builtin to convert the value to a string, when the values are set dictionary-style. >>> C = Cookie.SimpleCookie() >>> C["number"] = 7 >>> C["string"] = "seven" >>> C["number"].value '7' >>> C["string"].value 'seven' >>> C.output() 'Set-Cookie: number=7\r\nSet-Cookie: string=seven' SerialCookie The SerialCookie expects that all values should be serialized using cPickle (or pickle, if cPickle isn't available). As a result of serializing, SerialCookie can save almost any Python object to a value, and recover the exact same object when the cookie has been returned. (SerialCookie can yield some strange-looking cookie values, however.) >>> C = Cookie.SerialCookie() >>> C["number"] = 7 >>> C["string"] = "seven" >>> C["number"].value 7 >>> C["string"].value 'seven' >>> C.output() 'Set-Cookie: number="I7\\012."\r\nSet-Cookie: string="S\'seven\'\\012p1\\012."' Be warned, however, if SerialCookie cannot de-serialize a value (because it isn't a valid pickle'd object), IT WILL RAISE AN EXCEPTION. SmartCookie The SmartCookie combines aspects of each of the other two flavors. When setting a value in a dictionary-fashion, the SmartCookie will serialize (ala cPickle) the value *if and only if* it isn't a Python string. String objects are *not* serialized. Similarly, when the load() method parses out values, it attempts to de-serialize the value. If it fails, then it fallsback to treating the value as a string. >>> C = Cookie.SmartCookie() >>> C["number"] = 7 >>> C["string"] = "seven" >>> C["number"].value 7 >>> C["string"].value 'seven' >>> C.output() 'Set-Cookie: number="I7\\012."\r\nSet-Cookie: string=seven' Backwards Compatibility ----------------------- In order to keep compatibility with earlier versions of Cookie.py, it is still possible to use Cookie.Cookie() to create a Cookie. In fact, this simply returns a SmartCookie. >>> C = Cookie.Cookie() >>> print C.__class__.__name__ SmartCookie Finis. iÿÿÿÿN(tdumpstloadst CookieErrort BaseCookiet SimpleCookiet SerialCookiet SmartCookietCookiets; t cBseZRS((t__name__t __module__(((s+/opt/alt/python27/lib64/python2.7/Cookie.pyRåss[\x00-\x1F\x7F]cGsjxc|D][}t|tƒr1|jddƒ}nt|tƒsOt|ƒ}ntj|ƒrtSqWtS(slDetects control characters within a value. Supports any type, as cookie attributes can be any type. slatin-1treplace(t isinstancetunicodetencodetstrt_control_character_retsearchtTruetFalse(tvaltv((s+/opt/alt/python27/lib64/python2.7/Cookie.pyt_has_control_characterìs s!#$%&'*+-.^_`|~s\000ss\001ss\002ss\003ss\004ss\005ss\006ss\007ss\010ss\011s s\012s s\013s s\014s s\015s s\016ss\017ss\020ss\021ss\022ss\023ss\024ss\025ss\026ss\027ss\030ss\031ss\032ss\033ss\034ss\035ss\036ss\037ss\054t,s\073t;s\"t"s\\s\s\177ss\200s€s\201s�s\202s‚s\203sƒs\204s„s\205s…s\206s†s\207s‡s\210sˆs\211s‰s\212sŠs\213s‹s\214sŒs\215s�s\216sŽs\217s�s\220s�s\221s‘s\222s’s\223s“s\224s”s\225s•s\226s–s\227s—s\230s˜s\231s™s\232sšs\233s›s\234sœs\235s�s\236sžs\237sŸs\240s s\241s¡s\242s¢s\243s£s\244s¤s\245s¥s\246s¦s\247s§s\250s¨s\251s©s\252sªs\253s«s\254s¬s\255s­s\256s®s\257s¯s\260s°s\261s±s\262s²s\263s³s\264s´s\265sµs\266s¶s\267s·s\270s¸s\271s¹s\272sºs\273s»s\274s¼s\275s½s\276s¾s\277s¿s\300sÀs\301sÁs\302sÂs\303sÃs\304sÄs\305sÅs\306sÆs\307sÇs\310sÈs\311sÉs\312sÊs\313sËs\314sÌs\315sÍs\316sÎs\317sÏs\320sÐs\321sÑs\322sÒs\323sÓs\324sÔs\325sÕs\326sÖs\327s×s\330sØs\331sÙs\332sÚs\333sÛs\334sÜs\335sÝs\336sÞs\337sßs\340sàs\341sás\342sâs\343sãs\344säs\345sås\346sæs\347sçs\350sès\351sés\352sês\353sës\354sìs\355sís\356sîs\357sïs\360sðs\361sñs\362sòs\363sós\364sôs\365sõs\366sös\367s÷s\370søs\371sùs\372sús\373sûs\374süs\375sýs\376sþs\377sÿccs|]}t|ƒVqdS(N(tchr(t.0tx((s+/opt/alt/python27/lib64/python2.7/Cookie.pys GsicCsAd||||ƒkr|Sdtttj||ƒƒdSdS(NRR(t _nulljointmapt _Translatortget(Rt LegalCharstidmapt translate((s+/opt/alt/python27/lib64/python2.7/Cookie.pyt_quoteIss\\(?:([0-3][0-7][0-7])|(.))cCs<|jdƒr+tt|jdƒdƒƒS|jdƒSdS(Niii(tgroupRtint(tm((s+/opt/alt/python27/lib64/python2.7/Cookie.pyt_unquote_replaceYscCsTt|ƒdkr|S|ddks6|ddkr:|S|dd!}tt|ƒS(NiiRiÿÿÿÿi(tlent _unquote_subR)(R((s+/opt/alt/python27/lib64/python2.7/Cookie.pyt_unquote_s   tMontTuetWedtThutFritSattSuntJantFebtMartAprtMaytJuntJultAugtSeptOcttNovtDecic Csoddlm}m}|ƒ}|||ƒ\ }}}} } } } } }d|| ||||| | | fS(Niÿÿÿÿ(tgmtimettimes#%s, %02d %3s %4d %02d:%02d:%02d GMT(RAR@(tfuturet weekdaynamet monthnameR@RAtnowtyeartmonthtdaythhtmmtsstwdtytz((s+/opt/alt/python27/lib64/python2.7/Cookie.pyt_getdate‚s  +tMorselcBsÖeZidd6dd6dd6dd6dd6d d 6d d 6d d 6Zd d hZd „Zd„Zdd„Zd„Zd„Z e e e j d„Zd„Zddd„ZeZd„Zdd„Zdd„ZRS(texpirestPathtpathtCommenttcommenttDomaintdomainsMax-Agesmax-agetsecurethttponlytVersiontversioncCsBd|_|_|_x$|jD]}tj||dƒq!WdS(NR(tNonetkeytvaluet coded_valuet _reservedtdictt __setitem__(tselftK((s+/opt/alt/python27/lib64/python2.7/Cookie.pyt__init__¯scCsm|jƒ}||jkr.td|ƒ‚nt||ƒrVtd||fƒ‚ntj|||ƒdS(NsInvalid Attribute %ss3Control characters are not allowed in cookies %r %r(tlowerR`RRRaRb(RcRdtV((s+/opt/alt/python27/lib64/python2.7/Cookie.pyRb¸s  cCsl|jƒ}||jkr1td|fƒ‚nt||ƒrYtd||fƒ‚ntj|||ƒS(NsInvalid attribute %rs3Control characters are not allowed in cookies %r %r(RfR`RRRat setdefault(RcR]R((s+/opt/alt/python27/lib64/python2.7/Cookie.pyRhÁs  csÈtˆdƒr.‡fd†ˆjƒDƒ}nˆ}i}xw|D]o\}}|jƒ}||jkr~td|fƒ‚nt||ƒr¦td||fƒ‚n|||ÏssInvalid attribute %rs3Control characters are not allowed in cookies %r %r(thasattrRiRfR`RRRatupdate(RcRktiterabletdataR]R((Rks+/opt/alt/python27/lib64/python2.7/Cookie.pyRmÊs cCs|jƒ|jkS(N(RfR`(RcRd((s+/opt/alt/python27/lib64/python2.7/Cookie.pyt isReservedKeyÞscCs |jƒ|jkr(td|ƒ‚nd||||ƒkrStd|ƒ‚nt|||ƒr�td|||fƒ‚n||_||_||_dS(Ns!Attempt to set a reserved key: %sRsIllegal key value: %ss6Control characters are not allowed in cookies %r %r %r(RfR`RRR]R^R_(RcR]Rt coded_valR"R#R$((s+/opt/alt/python27/lib64/python2.7/Cookie.pytsetâs  cCso|jdƒ}|jdƒ}|jdƒ}t|||ƒr[td|||fƒ‚n|jj|ƒdS(NR]R^R_s6Control characters are not allowed in cookies %r %r %r(R!RRt__dict__Rm(RctstateR]R^R_((s+/opt/alt/python27/lib64/python2.7/Cookie.pyt __setstate__õss Set-Cookie:cCsd||j|ƒfS(Ns%s %s(t OutputString(Rctattrstheader((s+/opt/alt/python27/lib64/python2.7/Cookie.pytoutputscCs#d|jj|jt|jƒfS(Ns <%s: %s=%s>(t __class__R R]treprR^(Rc((s+/opt/alt/python27/lib64/python2.7/Cookie.pyt__repr__ s cCsPddl}|j|ƒ}t|ƒr6tdƒ‚n|j|ƒ}d|fS(Niÿÿÿÿs-Control characters are not allowed in cookiess� (tbase64RvRRt b64encode(RcRwR}t output_stringtoutput_encoded((s+/opt/alt/python27/lib64/python2.7/Cookie.pyt js_output s   cCs�g}|j}|d|j|jfƒ|dkrA|j}n|jƒ}|jƒx)|D]!\}}|dkr|q^n||krŽq^n|dkrÖt|ƒtdƒkrÖ|d|j|t|ƒfƒq^|dkrt|ƒtdƒkr|d|j||fƒq^|dkr>|t |j|ƒƒq^|dkrd|t |j|ƒƒq^|d|j||fƒq^Wt |ƒS( Ns%s=%sRRQismax-ages%s=%dRXRY( tappendR]R_R\R`titemstsortttypeRORt_semispacejoin(RcRwtresulttRARƒRdRg((s+/opt/alt/python27/lib64/python2.7/Cookie.pyRv s,       $$$  N(R R R`t_flagsReRbR\RhRmRpt _LegalCharst_idmaptstringR$RrRuRyt__str__R|R�Rv(((s+/opt/alt/python27/lib64/python2.7/Cookie.pyRP•s,        s,\w\d!#%&'~_`><@,:/\$\*\+\-\.\^\|\)\(\?\}\{\=s\[\]s(?x)\s*(?P[sN]+?)(\s*=\s*(?P"(?:[^\\"]|\\.)*"|\w{3},\s[\s\w\d-]{9,11}\s[\d:]{8}\sGMT|[s]*))?\s*(\s+|;|$)cBszeZd„Zd„Zd d„Zd„Zd„Zd ddd„ZeZ d„Z d d „Z d „Z e d „ZRS( cCs ||fS(s real_value, coded_value = value_decode(STRING) Called prior to setting a cookie's value from the network representation. The VALUE is the value read from HTTP header. Override this function to modify the behavior of cookies. ((RcR((s+/opt/alt/python27/lib64/python2.7/Cookie.pyt value_decodekscCst|ƒ}||fS(sýreal_value, coded_value = value_encode(VALUE) Called prior to setting a cookie's value from the dictionary representation. The VALUE is the value being assigned. Override this function to modify the behavior of cookies. (R(RcRtstrval((s+/opt/alt/python27/lib64/python2.7/Cookie.pyt value_encodeus cCs|r|j|ƒndS(N(tload(Rctinput((s+/opt/alt/python27/lib64/python2.7/Cookie.pyRescCs?|j|tƒƒ}|j|||ƒtj|||ƒdS(s+Private method for setting a cookie's valueN(R!RPRrRaRb(RcR]t real_valueR_tM((s+/opt/alt/python27/lib64/python2.7/Cookie.pyt__setƒscCsQt|tƒr%tj|||ƒn(|j|ƒ\}}|j|||ƒdS(sDictionary style assignment.N(R RPRaRbR�t_BaseCookie__set(RcR]R^trvaltcval((s+/opt/alt/python27/lib64/python2.7/Cookie.pyRbŠss Set-Cookie:s c Cszg}|jƒ}|jƒxN|D]F\}}|j||ƒ}t|ƒr\tdƒ‚n|j|ƒq#W|j|ƒS(s"Return a string suitable for HTTP.s-Control characters are not allowed in cookies(RƒR„RyRRR‚tjoin( RcRwRxtsepR‡RƒRdRgt value_output((s+/opt/alt/python27/lib64/python2.7/Cookie.pyRy”s   cCsmg}|jƒ}|jƒx4|D],\}}|jd|t|jƒfƒq#Wd|jjt|ƒfS(Ns%s=%ss<%s: %s>(RƒR„R‚R{R^RzR t _spacejoin(RctLRƒRdRg((s+/opt/alt/python27/lib64/python2.7/Cookie.pyR|£s   $cCsSg}|jƒ}|jƒx*|D]"\}}|j|j|ƒƒq#Wt|ƒS(s(Return a string suitable for JavaScript.(RƒR„R‚R�R(RcRwR‡RƒRdRg((s+/opt/alt/python27/lib64/python2.7/Cookie.pyR�«s   cCsSt|ƒtdƒkr(|j|ƒn'x$|jƒD]\}}|||ËsÀ          ·   $