/usr/local/lib64/python3.6/site-packages/flask/__pycache__
NameSizeModeActions
app.cpython-36.pyc628380644editdlrm
blueprints.cpython-36.pyc218950644editdlrm
cli.cpython-36.pyc268820644editdlrm
config.cpython-36.pyc115620644editdlrm
ctx.cpython-36.pyc154410644editdlrm
debughelpers.cpython-36.pyc63770644editdlrm
globals.cpython-36.pyc17420644editdlrm
helpers.cpython-36.pyc270040644editdlrm
logging.cpython-36.pyc24000644editdlrm
scaffold.cpython-36.pyc247450644editdlrm
sessions.cpython-36.pyc135440644editdlrm
signals.cpython-36.pyc23320644editdlrm
templating.cpython-36.pyc54490644editdlrm
testing.cpython-36.pyc90890644editdlrm
typing.cpython-36.pyc13630644editdlrm
views.cpython-36.pyc49100644editdlrm
wrappers.cpython-36.pyc49010644editdlrm
__init__.cpython-36.pyc18390644editdlrm
__main__.cpython-36.pyc1700644editdlrm
Edit: /usr/local/lib64/python3.6/site-packages/flask/__pycache__/sessions.cpython-36.pyc (13544B)
3 ^TBgb=@sddlZddlZddlZddlmZddlmZddlmZddlm Z ddl m Z ddl m Z dd lmZejrddlZdd lmZdd lmZmZGd d d eZGddde eZGdddeZGdddZeZGdddeZdS)N)MutableMapping)datetime) BadSignature)URLSafeTimedSerializer) CallbackDict)is_ip)TaggedJSONSerializer)Flask)RequestResponsec@sDeZdZdZeedddZejeddddZdZd Z d Z dS) SessionMixinz3Expands a basic dictionary with session attributes.)returncCs |jddS)z3This reflects the ``'_permanent'`` key in the dict. _permanentF)get)selfr//tmp/pip-build-0s3hx122/flask/flask/sessions.py permanentszSessionMixin.permanentN)valuercCst||d<dS)Nr)bool)rrrrrrsFT) __name__ __module__ __qualname____doc__propertyrrsetternewmodifiedaccessedrrrrr sr cseZdZdZdZdZdejddfdd Ze ejdfdd Z de ejejd fd d Z de ejejd fd d Z Z S)SecureCookieSessiona Base class for sessions based on signed cookies. This session backend will set the :attr:`modified` and :attr:`accessed` attributes. It cannot reliably track whether a session is new (vs. empty), so :attr:`new` remains hard coded to ``False``. FN)initialrcs dddd}tj||dS)N)rcSsd|_d|_dS)NT)rr)rrrr on_updateGsz/SecureCookieSession.__init__..on_update)super__init__)rr!r") __class__rrr$FszSecureCookieSession.__init__)keyrcsd|_tj|S)NT)rr# __getitem__)rr&)r%rrr'MszSecureCookieSession.__getitem__)r&defaultrcsd|_tj||S)NT)rr#r)rr&r()r%rrrQszSecureCookieSession.getcsd|_tj||S)NT)rr# setdefault)rr&r()r%rrr)UszSecureCookieSession.setdefault)N)N)N)rrrrrrtAnyr$strr'rr) __classcell__rr)r%rr 0sr c@sDeZdZdZejejddddZeZZZ Z Z Z Z [dS) NullSessionzClass used to generate nicer error messages if sessions are not available. Will still allow read-only access to the empty session but fail on setting. z te.NoReturn)argskwargsrcOs tddS)NzThe session is unavailable because no secret key was set. Set the secret_key on the application to something unique and secret.) RuntimeError)rr/r0rrr_fail`szNullSession._failN)rrrrr*r+r2 __setitem__ __delitem__clearpoppopitemupdater)rrrrr.Zsr.c@seZdZdZeZdZdedddZee ddd Z de dd d Z de je dd d Zde dddZde dddZde dddZde dddZdee jedddZdee dddZdde jedddZdedd d!d"d#Zd S)$SessionInterfacea4The basic interface you have to implement in order to replace the default session interface which uses werkzeug's securecookie implementation. The only methods you have to implement are :meth:`open_session` and :meth:`save_session`, the others have useful defaults which you don't need to change. The session object returned by the :meth:`open_session` method has to provide a dictionary like interface plus the properties and methods from the :class:`SessionMixin`. We recommend just subclassing a dict and adding that mixin:: class Session(dict, SessionMixin): pass If :meth:`open_session` returns ``None`` Flask will call into :meth:`make_null_session` to create a session that acts as replacement if the session support cannot work because some requirement is not fulfilled. The default :class:`NullSession` class that is created will complain that the secret key was not set. To replace the session interface on an application all you have to do is to assign :attr:`flask.Flask.session_interface`:: app = Flask(__name__) app.session_interface = MySessionInterface() Multiple requests with the same session may be sent and handled concurrently. When implementing a new session interface, consider whether reads or writes to the backing store must be synchronized. There is no guarantee on the order in which the session for each request is opened or saved, it will occur in the order that requests begin and end processing. .. versionadded:: 0.8 Fr )apprcCs|jS)aCreates a null session which acts as a replacement object if the real session support could not be loaded due to a configuration error. This mainly aids the user experience because the job of the null session is to still support lookup without complaining but modifications are answered with a helpful error message of what failed. This creates an instance of :attr:`null_session_class` by default. )null_session_class)rr:rrrmake_null_sessions z"SessionInterface.make_null_session)objrcCs t||jS)zChecks if a given object is a null session. Null sessions are not asked to be saved. This checks if the object is an instance of :attr:`null_session_class` by default. ) isinstancer;)rr=rrris_null_sessionsz SessionInterface.is_null_sessioncCs|jS)zReturns the name of the session cookie. Uses ``app.session_cookie_name`` which is set to ``SESSION_COOKIE_NAME`` )Zsession_cookie_name)rr:rrrget_cookie_namesz SessionInterface.get_cookie_namecCs|jd}|dk r|r|SdS|jd}|s:d|jd<dS|jdddjd}d|kr|tj|d |d d|jd<dSt|}|rtjd |j|d kr| rd|}||jd<|S) aMReturns the domain that should be set for the session cookie. Uses ``SESSION_COOKIE_DOMAIN`` if it is configured, otherwise falls back to detecting the domain based on ``SERVER_NAME``. Once detected (or if not set at all), ``SESSION_COOKIE_DOMAIN`` is updated to avoid re-running the logic. ZSESSION_COOKIE_DOMAINNZ SERVER_NAMEF:rr.zd is not a valid cookie domain, it must contain a '.'. Add an entry to your hosts file, for example 'z$.localdomain', and use that instead.zThe session cookie domain is an IP address. This may not work as intended in some browsers. Add an entry to your hosts file, for example "localhost.localdomain", and use that instead./)configrsplitlstripwarningswarnrget_cookie_path)rr:rviprrrget_cookie_domains*       z"SessionInterface.get_cookie_domaincCs|jdp|jdS)aReturns the path for which the cookie should be valid. The default implementation uses the value from the ``SESSION_COOKIE_PATH`` config var if it's set, and falls back to ``APPLICATION_ROOT`` or uses ``/`` if it's ``None``. ZSESSION_COOKIE_PATHZAPPLICATION_ROOT)rD)rr:rrrrIsz SessionInterface.get_cookie_pathcCs |jdS)zReturns True if the session cookie should be httponly. This currently just returns the value of the ``SESSION_COOKIE_HTTPONLY`` config var. ZSESSION_COOKIE_HTTPONLY)rD)rr:rrrget_cookie_httponlysz$SessionInterface.get_cookie_httponlycCs |jdS)zReturns True if the cookie should be secure. This currently just returns the value of the ``SESSION_COOKIE_SECURE`` setting. ZSESSION_COOKIE_SECURE)rD)rr:rrrget_cookie_securesz"SessionInterface.get_cookie_securecCs |jdS)zReturn ``'Strict'`` or ``'Lax'`` if the cookie should use the ``SameSite`` attribute. This currently just returns the value of the :data:`SESSION_COOKIE_SAMESITE` setting. ZSESSION_COOKIE_SAMESITE)rD)rr:rrrget_cookie_samesitesz$SessionInterface.get_cookie_samesite)r:sessionrcCs|jrtj|jSdS)aA helper method that returns an expiration date for the session or ``None`` if the session is linked to the browser session. The default implementation returns now + the permanent session lifetime configured on the application. N)rrutcnowpermanent_session_lifetime)rr:rPrrrget_expiration_timesz$SessionInterface.get_expiration_timecCs|jp|jo|jdS)aUsed by session backends to determine if a ``Set-Cookie`` header should be set for this session cookie for this response. If the session has been modified, the cookie is set. If the session is permanent and the ``SESSION_REFRESH_EACH_REQUEST`` config is true, the cookie is always set. This check is usually skipped if the session was deleted. .. versionadded:: 0.11 ZSESSION_REFRESH_EACH_REQUEST)rrrD)rr:rPrrrshould_set_cookies z"SessionInterface.should_set_cookier )r:requestrcCs tdS)aThis is called at the beginning of each request, after pushing the request context, before matching the URL. This must return an object which implements a dictionary-like interface as well as the :class:`SessionMixin` interface. This will return ``None`` to indicate that loading failed in some way that is not immediately an error. The request context will fall back to using :meth:`make_null_session` in this case. N)NotImplementedError)rr:rUrrr open_session+szSessionInterface.open_sessionr N)r:rPresponsercCs tdS)zThis is called at the end of each request, after generating a response, before removing the request context. It is skipped if :meth:`is_null_session` returns ``True``. N)rV)rr:rPrXrrr save_session;szSessionInterface.save_session)rrrrr.r;Z pickle_basedr<objectrr?r,r@r*OptionalrLrIrMrNrOr rrSrTrWrYrrrrr9ks$#  : r9c@sleZdZdZdZeejZdZ e Z e Z dejedddZddeje d d d Zded d dddZd S)SecureCookieSessionInterfacezuThe default session interface that stores sessions in signed cookies through the :mod:`itsdangerous` module. zcookie-sessionhmacr )r:rcCs0|js dSt|j|jd}t|j|j|j|dS)N)key_derivation digest_method)salt serializer signer_kwargs)Z secret_keydictr^r_rr`ra)rr:rbrrrget_signing_serializer[sz3SecureCookieSessionInterface.get_signing_serializerr )r:rUrc Csx|j|}|dkrdS|jj|j|}|s4|jSt|jj}y|j||d}|j|St k rr|jSXdS)N)max_age) rdcookiesrr@ session_classintrR total_secondsloadsr)rr:rUsvalredatarrrrWjs  z)SecureCookieSessionInterface.open_sessionr N)r:rPrXrc Cs|j|}|j|}|j|}|j|}|j|}|sT|jrP|j|||||ddS|jrf|jj d|j ||svdS|j |} |j ||} |j |jt|} |j|| | | ||||ddS)N)domainpathsecuresamesiteCookie)expireshttponlyrnrorprq)r@rLrIrNrOrZ delete_cookiervaryaddrTrMrSrddumpsrc set_cookie) rr:rPrXnamernrorprqrtrsrlrrrrYzs4         z)SecureCookieSessionInterface.save_session)rrrrr` staticmethodhashlibsha1r_r^session_json_serializerrar rgr*r[rrdrWr rYrrrrr\Hs r\)r{Ztypingr*rGcollections.abcrrZ itsdangerousrrZwerkzeug.datastructuresrhelpersrZjson.tagr Z TYPE_CHECKINGZtyping_extensionster:r Zwrappersr r r r r.r9r}r\rrrrs(        *[