mò YÄ;c @s+dZdkZdklZlZlZdZdZdfd„ƒYZei ei ei ei ei eid„ZeZedjo ed d d d d dddƒZeGHeiƒZeeƒZeGHeed ƒZeGHHed d d dƒZeiƒGHeiƒZeeƒZeiƒGHndS(s Cookie -- Create sendable Netscape Cookies. Needs mxDateTime, mxURL and mxTextTools. Copyright (c) 2000, Marc-Andre Lemburg; All Rights Reserved. See the documentation for further information on copyrights, or contact the author. All Rights Reserved. N(sDateTimesURLs TextToolss1.2itCookiecBsžtZdZeZdZdZdZeeeed„Ze i e i e i eid„ZeZd„ZeZe i d„Zed„Zd „Zd „ZRS( s2 Cookie object, cf. Netscape's specification. t/ticCsÄ||_||_|dj oet|tiƒo ||_q„t|tiƒot ƒ||_q„ti ƒ|ti |_n|o ||_ n|o ||_ n|o d|_ ndS(s Create a Netscape cookie for name with the given value. If expires is given, the cookie will be a temporary cookie which expires after a certain amount of time. expires may be given as integer (seconds relative to the current time), DateTime instance (absolute date/time) or RelativeDateTime instance (relative date/time to current time). path, domain, secure work according to the Netscape specification. iN(tnametselftvaluetexpirestNonet isinstancetDateTimet DateTimeTypetRelativeDateTimetnowt oneSecondtpathtdomaintsecure(RRRRRRR((t9/data/zmath/lib/python2.4/site-packages/mx/Misc/Cookie.pyt__init__s      cCs¤d|i||iƒfd|ig}|idj o!|id|ii dƒƒn|i o|id|i ƒn|i o|idƒn||dƒS(Ns%s=%sspath=%ss expires=%ss%a, %d %b %Y %H:%M:%S GMTs domain=%sRt;( RRt urlencodeRRtlRRtappendtstrftimeRRtjoin(RR R RRR((Rtheader_content?s)!  cCsd|iƒS(NsSet-Cookie: %s (RR(R((Rtset_cookie_headerSscCsd|i||iƒfS(NsCookie: %s=%s (RRRR(RR((Rt cookie_headerZscCsàti|ƒ}|idj oI|djotiƒ}n|i|joto dGHndSqhnt i |i |i fƒdjoto dGHndSnt i |i |ifƒdjoto dGHndSndS(sú Return 1/0 depending on whether the Cookie matches the given url or not. datetime is used to check for expiration in case the Cookie is a temporary one. It defaults to the current date/time. texpiredispath does not matchsdomain does not matchiN(tURLturlRRRtdatetimeR R t_debugt TextToolstprefixRtsuffixthostR(RRR((Rtmatch`s$    " " cCsd|iƒS(NsSet-Cookie: %s(RR(R((Rt__str__|scCs/d|ii|ii|i|it|ƒfS(Ns<%s.%s "%s = %s" at 0x%x>(Rt __class__t __module__t__name__RRtid(R((Rt__repr__€s(R)R(t__doc__RRRRRRR R R RRtstringRRtcontentRt http_headerRR%R&R+(((RRs "!   c Cs:t|||dƒƒ}tddƒ}|p|Sn||ddƒ\|_}||ƒ|_t |ƒdjoÂx¿|dD]¯} || dƒ\} }|| ƒ} | djo ||_q| djo-y||ƒ|_Wq.tj oq.Xq| d jo ||_q| d jo d|_qqWn|S( sb Parse the value of an Set-Cookie header and return a corresponding Cookie instance. Rsno-nameRit=iRRRRN(tmaptstript charsplitRtitemsRtctsplitatRt urldecodetlentitemtkeytlowerRt DateTimeFromRt ValueErrorRR( RR6R2R3R7R;R<R4R5R9R:((RtCookieFromHeader‹s0          t__main__tatbRs/mysiteRiRs egenix.comiöÿÿÿi (R,R-tmxR RR!t __version__R RR6R2R3R7R;R<R>t ParserCookieR)tc1Rts1tc2tc3tc4Rtc5R(R!R-R RR>RFR RRGRHRDRCRERJRI((Rt? s, x-#