Ñò ìÿÒXc @ sz d d k Z d d k Z d d k Z d d k Z d d k l Z d d k l Z d d k l Z d e f d „ ƒ YZ d S( iÿÿÿÿN( t urlparse( t timegm( t log_mgrt Cookiec B sº e Z d Z d e f d „ ƒ YZ d e f d „ ƒ YZ e i d ƒ Z e i d e i ƒ Z h d d 6d d 6d d 6d d 6d d 6d d 6Z e d „ ƒ Z e d# d „ ƒ Z e d „ ƒ Z e d „ ƒ Z e d# d „ ƒ Z e d# d „ ƒ Z d# d# d# d# d# d# d# d „ Z e d „ ƒ Z e i d „ ƒ Z e d „ ƒ Z e i d „ ƒ Z e d „ ƒ Z e i d „ ƒ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d! „ Z d" „ Z! RS($ só A Cookie object has the following attributes: key The name of the cookie value The value of the cookie A Cookie also supports these predefined optional attributes. If an optional attribute is not set on the cookie it's value is None. domain Restrict cookie usage to this domain path Restrict cookie usage to this path or below expires Cookie is invalid after this UTC timestamp max_age Cookie is invalid this many seconds in the future. Has precedence over the expires attribute. secure Cookie should only be returned on secure (i.e. SSL/TLS) connections. httponly Cookie is intended only for HTTP communication, it can never be utilized in any other context (e.g. browser Javascript). See the documentation of get_expiration() for an explanation of how the expires and max-age attributes interact as well as the role of the timestamp attribute. Expiration values are stored as datetime objects for easy manipulation and comparision. There are two ways to instantiate a Cookie object. Either directly via the constructor or by calling the class function parse() which returns a list of Cookie objects found in a string. To create a cookie to sent to a client: Example: cookie = Cookie('session', session_id, domain=my_domain, path=mypath, httpOnly=True, secure=True, expires=expiration) headers.append(('Set-Cookie', str(cookie))) To receive cookies from a request: Example: cookies = Cookie.parse(response.getheader('Set-Cookie'), request_url) t Expiredc B s e Z RS( ( t __name__t __module__( ( ( s4 /usr/lib/python2.6/site-packages/ipapython/cookie.pyR s t URLMismatchc B s e Z RS( ( R R ( ( ( s4 /usr/lib/python2.6/site-packages/ipapython/cookie.pyR „ s s ;\s*s@ ^\s*([a-zA-Z0-9\!\#\$\%\&\'\*\+\-\.\^\_\`\|\~]+)\s*=\s*(.*?)\s*$t domaint patht max_ages max-aget expirest securet httponlyc C s t | i ƒ ƒ S( sg Timestamps (timestamp & expires) are stored as datetime objects in UTC. It's non-obvious how to convert a naive UTC datetime into a unix time value (seconds since the epoch UTC). That functionality is oddly missing from the datetime and time modules. This utility provides that missing functionality. ( R t utctimetuple( t clst dt( ( s4 /usr/lib/python2.6/site-packages/ipapython/cookie.pyt datetime_to_time– s c C s[ | i ƒ } | d j o# | i ƒ d j o t d ƒ ‚ n t i i | i | ƒ d t ƒS( sO Given a datetime object in UTC generate RFC 1123 date string. g s timezone is not UTCt usegmtN( t utcoffsett Nonet total_secondst ValueErrort emailt utilst formatdateR t True( R R R ( ( s4 /usr/lib/python2.6/site-packages/ipapython/cookie.pyt datetime_to_string£ s c C sd | i ƒ } y&