(morsel)
return create_cookie(
        comment=morsel['comment'],
        comment_url=bool(morsel['comment']),
        discard=False,
        domain=morsel['domain'],
        expires=expires,
        name=morsel.key,
        path=morsel['path'],
        port=None,
        rest={'HttpOnly': morsel['httponly']},
        rfc2109=False,
        secure=bool(morsel['secure']),
        value=morsel.value,
        version=morsel['version'] or 0,
    )
Convert a Morsel object into a Cookie containing the one k/v pair.
Convert a Morsel object into a Cookie containing the one k/v pair.
Convert a Morsel object into a Cookie containing the one k / v pair .
def morsel_to_cookie(morsel):
    """Convert a Morsel object into a Cookie containing the one k/v pair."""

    expires = None
    if morsel['max-age']:
        try:
            expires = int(time.time() + int(morsel['max-age']))
        except ValueError:
            raise TypeError('max-age: %s must be integer' % morsel['max-age'])
    elif morsel['expires']:
        time_template = '%a, %d-%b-%Y %H:%M:%S GMT'
        expires = int(time.mktime(
            time.strptime(morsel['expires'], time_template)) - time.timezone)
    return create_cookie(
        comment=morsel['comment'],
        comment_url=bool(morsel['comment']),
        discard=False,
        domain=morsel['domain'],
        expires=expires,
        name=morsel.key,
        path=morsel['path'],
        port=None,
        rest={'HttpOnly': morsel['httponly']},
        rfc2109=False,
        secure=bool(morsel['secure']),
        value=morsel.value,
        version=morsel['version'] or 0,
    )
def morsel_to_cookie ( morsel ) : expires = None if morsel [ 'max-age' ] : try : expires = int ( time . time ( ) + int ( morsel [ 'max-age' ] ) ) except ValueError : raise TypeError ( 'max-age: %s must be integer' % morsel [ 'max-age' ] ) elif morsel [ 'expires' ] : time_template = '%a, %d-%b-%Y %H:%M:%S GMT' expires = int ( time . mktime ( time . strptime ( morsel [ 'expires' ] , time_template ) ) - time . timezone ) return create_cookie ( comment = morsel [ 'comment' ] , comment_url = bool ( morsel [ 'comment' ] ) , discard = False , domain = morsel [ 'domain' ] , expires = expires , name = morsel . key , path = morsel [ 'path' ] , port = None , rest = { 'HttpOnly' : morsel [ 'httponly' ] } , rfc2109 = False , secure = bool ( morsel [ 'secure' ] ) , value = morsel . value , version = morsel [ 'version' ] or 0 , )