ÿØÿàJFIFÿþ ÿÛC       ÿÛC ÿÀÿÄÿÄ"#QrÿÄÿÄ&1!A"2qQaáÿÚ ?Øy,æ/3JæÝ¹È߲؋5êXw²±ÉyˆR”¾I0ó2—PI¾IÌÚiMö¯–þrìN&"KgX:Šíµ•nTJnLK„…@!‰-ý ùúmë;ºgµŒ&ó±hw’¯Õ@”Ü— 9ñ-ë.²1<yà‚¹ïQÐU„ہ?.’¦èûbß±©Ö«Âw*VŒ) `$‰bØÔŸ’ëXÖ-ËTÜíGÚ3ð«g Ÿ§¯—Jx„–’U/ÂÅv_s(Hÿ@TñJÑãõçn­‚!ÈgfbÓc­:él[ðQe 9ÀPLbÃãCµm[5¿ç'ªjglå‡Ûí_§Úõl-;"PkÞÞÁQâ¼_Ñ^¢SŸx?"¸¦ùY騐ÒOÈ q’`~~ÚtËU¹CڒêV  I1Áß_ÿÙ aNc@sdZddlmZddlZddlZddlZddlZddlZddlZyddl Z Wne k rddl Z nXyddl m Z Wn!e k rddl m Z nXddlmZddlmZdefdYZd efd YZdaeaejd dadefdYZdefdYZeZeeeeedZdS(s Creates a session object in your WSGI environment. Use like: ..code-block:: Python environ['paste.session.factory']() This will return a dictionary. The contents of this dictionary will be saved to disk when the request is completed. The session will be created when you first fetch the session dictionary, and a cookie will be sent in that case. There's current no way to use sessions without cookies, and there's no way to delete a session except to clear its data. @@: This doesn't do any locking, and may cause problems when a single session is accessed concurrently. Also, it loads and saves the session for each request, with no caching. Also, sessions aren't expired. i(t SimpleCookieN(tmd5(twsgilib(trequesttSessionMiddlewarecBseZddZdZRS(cKs||_||_dS(N(t applicationt factory_kw(tselfRt global_confR((s>/opt/alt/python27/lib/python2.7/site-packages/paste/session.pyt__init__/s cst||j|d/opt/alt/python27/lib/python2.7/site-packages/paste/session.pytsession_start_response8s    cs]jrYrY\}}|jjtd}|||j|dfndS(NsLYou cannot get the session after content from the app_iter has been returned(R R R t ValueErrort __class__tNone(R Rtexc(RRR(s>/opt/alt/python27/lib/python2.7/site-packages/paste/session.pytstart@s   csjrjndS(N(tusedtclose((R(s>/opt/alt/python27/lib/python2.7/site-packages/paste/session.pyRIs (tSessionFactoryRRRRtadd_start_close(RtenvironRRtapp_iterRR((RRRs>/opt/alt/python27/lib/python2.7/site-packages/paste/session.pyt__call__3s  N(t__name__t __module__RR R(((s>/opt/alt/python27/lib/python2.7/site-packages/paste/session.pyR-s RcBsSeZdd d dZdZdZdZd dZdZd Z RS( t_SID_i<i cKsRt|_t|_||_||_d|_|p6t|_||_ ||_ dS(N( tFalseR RRt cookie_nameRtsessiont FileSessiont session_classtsession_class_kwt expiration(RRR$R'tsession_expirationR(((s>/opt/alt/python27/lib/python2.7/site-packages/paste/session.pyR Rs      cCst|_|jdk r%|jjStj|j}d}|j|j r||j j |_ y"|j |j dt |j}Wqtk rqXn|dkrt|_|j|_ |j |j dt|j}n|j||_|jS(Ntcreate(tTrueRR%RtdataRt get_cookiesRthas_keyR$tvaluetsidR'R#R(tKeyErrorR tmake_sidtclean_up(RtcookiesR%((s>/opt/alt/python27/lib/python2.7/site-packages/paste/session.pyRas(       cCs?|jdk rtStj|j}|j|jr;tStS(N( R%RR,RR.RR/R$R#(RR5((s>/opt/alt/python27/lib/python2.7/site-packages/paste/session.pyt has_sessionxs cCsEdjgtjtjd D]}d|^q d|jS(Ntis%02dt-(tjointtimet localtimet unique_id(Rtx((s>/opt/alt/python27/lib/python2.7/site-packages/paste/session.pyR3scCstjtjg}ttdr=|jtjn|dk r_|jt|ntt |}y|j SWnOt k rg}x+|j D]}|jdt |qWdj|SXdS(s Generates an opaque, identifier string that is practically guaranteed to be unique. If an object is passed, then its id() is incorporated into the generation. Relies on md5 and returns a 32 character long string. ttimess%02xR7N(R:trandomthasattrtosR R>RtidRtstrt hexdigesttAttributeErrortdigesttordR9(Rt for_objecttrtmd5_hashRDtchar((s>/opt/alt/python27/lib/python2.7/site-packages/paste/session.pyR<s  cCst}|j||j/opt/alt/python27/lib/python2.7/site-packages/paste/session.pyR s  cCs#|jdk r|jjndS(N(R%RR(R((s>/opt/alt/python27/lib/python2.7/site-packages/paste/session.pyRsNi( R R!RR RR6R3R<R R(((s>/opt/alt/python27/lib/python2.7/site-packages/paste/session.pyROs     tsecondsii<R&cBsYeZeejdddZdZdZdZ dZ dZ dZ RS( i@ cCs|r't|tr't|d}n||_|s?tn||_||_|s{tjj |j s{tq{nd|_ ||_ dS(Ni(t isinstancet basestringtinttchmodR2tsession_file_pathR1RARMtexiststfilenameRt_dataR)(RR1R+RZRYR)((s>/opt/alt/python27/lib/python2.7/site-packages/paste/session.pyR s      cCstjj|j|jS(N(RARMR9RZR1(R((s>/opt/alt/python27/lib/python2.7/site-packages/paste/session.pyR\scCsr|jdk r|jStjj|jrbt|jd}tj||_|j n i|_|jS(Ntrb( R]RRARMR[R\topentcPickletloadR(Rtf((s>/opt/alt/python27/lib/python2.7/site-packages/paste/session.pyR-s  cCs|jdk r|j}tjj|}|jsO|rtj|qqt|d}tj |j||j | r|j rtj ||j qndS(Ntwb( R]RR\RARMR[tunlinkR_R`tdumpRRY(RR\R[Rb((s>/opt/alt/python27/lib/python2.7/site-packages/paste/session.pyRs   cCsz|tjd|jd}tjj}xMtj|jD]9\}}}x'|D]}|j|d|d|qTWq>WWdta XdS(NRUi<texp_timetnow( tdatetimet timedeltaR)RgRAtwalkRZt_clean_up_fileR#t cleaning_up(RRfRgtroottdirstfilesRb((s>/opt/alt/python27/lib/python2.7/site-packages/paste/session.pyt _clean_ups" %c Cs|jd}t|dkr%dS|d}yptjt|dd!t|dd!t|dd!t|dd!t|dd!t|dd !}Wntk rdSX|||krtjtjj|j |ndS( NR8iiiiii i i( RQtlenRhRXRRAtremoveRMR9RZ(RRbRfRgttt sess_time((s>/opt/alt/python27/lib/python2.7/site-packages/paste/session.pyRks   cCstjj}trdSt s0tt|kr~ts~tay)|atjd|j}|j Wq{t aq{Xq~ndS(Nttarget( RhRgRlt last_cleanupt cleanup_cycleR,t threadingtThreadRpRR#(RRgRs((s>/opt/alt/python27/lib/python2.7/site-packages/paste/session.pyR4sN( R R!R#ttempfilet gettempdirRR R\R-RRpRkR4(((s>/opt/alt/python27/lib/python2.7/site-packages/paste/session.pyR&s     t _NoDefaultcBseZdZRS(cCsdS(Ns((R((s>/opt/alt/python27/lib/python2.7/site-packages/paste/session.pyt__repr__s(R R!R}(((s>/opt/alt/python27/lib/python2.7/site-packages/paste/session.pyR|sc Cs|tkr!|jdd }nt|}|tkrN|jdd}nt|}|tkr{|jdd}n|tkr|jdd }n|tkr|jd d}nt|d|d|d |d|d |S(s Adds a middleware that handles sessions for your applications. The session is a peristent dictionary. To get this dictionary in your application, use ``environ['paste.session.factory']()`` which returns this persistent dictionary. Configuration: session_expiration: The time each session lives, in minutes. This controls the cookie expiration. Default 12 hours. expiration: The time each session lives on disk. Old sessions are culled from disk based on this. Default 48 hours. cookie_name: The cookie name used to track the session. Use different names to avoid session clashes. session_file_path: Sessions are put in this location, default /tmp. chmod: The octal chmod you want to apply to new sessions (e.g., 660 to make the sessions group readable/writable) Each of these also takes from the global configuration. cookie_name and chmod take from session_cookie_name and session_chmod R*i<i R)i0tsession_cookie_nameR"RZs/tmpt session_chmodR$RYii@ N(t NoDefaulttgetRXRR(tappRR*R)R$RZRY((s>/opt/alt/python27/lib/python2.7/site-packages/paste/session.pytmake_session_middlewares %         i(t__doc__tCookieRR:R?RARhRxRzR`t ImportErrortpicklethashlibRtpasteRRtobjectRRRRvR#RlRiRwR&R|RR(((s>/opt/alt/python27/lib/python2.7/site-packages/paste/session.pyts<        "]h