ó
i4Vdc           @   sJ   d  d l  m Z d  d l m Z d  d l m Z d e f d     YZ d S(   i˙˙˙˙(   t   settings(   t   SessionBase(   t   signingt   SessionStorec           B   s_   e  Z d    Z d   Z e d  Z d d  Z d d  Z d   Z	 d   Z
 e d    Z RS(	   c         C   sN   y, t  j |  j d |  j d t j d d SWn t k
 rI |  j   n Xi  S(   sÁ   
        We load the data from the key itself instead of fetching from
        some external data store. Opposite of _get_session_key(),
        raises BadSignature if signature fails.
        t
   serializert   max_aget   salts/   django.contrib.sessions.backends.signed_cookies(   R   t   loadst   session_keyR   R    t   SESSION_COOKIE_AGEt	   Exceptiont   create(   t   self(    (    s}   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/sessions/backends/signed_cookies.pyt   load   s    		c         C   s   t  |  _ d S(   sĄ   
        To create a new key, we simply make sure that the modified flag is set
        so that the cookie is set on the client for the current request.
        N(   t   Truet   modified(   R   (    (    s}   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/sessions/backends/signed_cookies.pyR      s    c         C   s   |  j    |  _ t |  _ d S(   s˝   
        To save, we get the session key as a securely signed string and then
        set the modified flag so that the cookie is set on the client for the
        current request.
        N(   t   _get_session_keyt   _session_keyR   R   (   R   t   must_create(    (    s}   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/sessions/backends/signed_cookies.pyt   save!   s    c         C   s   t  S(   sľ   
        This method makes sense when you're talking to a shared resource, but
        it doesn't matter when you're storing the information in the client's
        cookie.
        (   t   False(   R   R   (    (    s}   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/sessions/backends/signed_cookies.pyt   exists*   s    c         C   s   d |  _  i  |  _ t |  _ d S(   sÂ   
        To delete, we clear the session key and the underlying data structure
        and set the modified flag so that the cookie is set on the client for
        the current request.
        t    N(   R   t   _session_cacheR   R   (   R   R   (    (    s}   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/sessions/backends/signed_cookies.pyt   delete2   s    		c         C   s   |  j    d S(   sČ   
        Keeps the same data but with a new key.  To do this, we just have to
        call ``save()`` and it will automatically save a cookie with a new key
        at the end of the request.
        N(   R   (   R   (    (    s}   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/sessions/backends/signed_cookies.pyt	   cycle_key<   s    c         C   s4   t  |  d i   } t j | d t d d d |  j S(   sţ   
        Most session backends don't need to override this method, but we do,
        because instead of generating a random string, we want to actually
        generate a secure url-safe Base64-encoded string of data as our
        session key.
        R   t   compressR   s/   django.contrib.sessions.backends.signed_cookiesR   (   t   getattrR   t   dumpsR   R   (   R   t   session_cache(    (    s}   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/sessions/backends/signed_cookies.pyR   D   s    c         C   s   d  S(   N(    (   t   cls(    (    s}   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/sessions/backends/signed_cookies.pyt   clear_expiredP   s    N(   t   __name__t
   __module__R   R   R   R   t   NoneR   R   R   R   t   classmethodR   (    (    (    s}   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/sessions/backends/signed_cookies.pyR      s   			
		N(   t   django.confR    t%   django.contrib.sessions.backends.baseR   t   django.coreR   R   (    (    (    s}   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/sessions/backends/signed_cookies.pyt   <module>   s   