original_docstring: Gets the requestor's user info from a cookie dictionary.
  
    Args:
      cookie_dict: A dictionary mapping cookie names onto values.
      cookie_name: The name of the cookie that stores the user info.
  
    Returns:
      A tuple (email, admin, user_id) where:
        email: The user's email address, if any.
        admin: True if the user is an admin; False otherwise.
        user_id: The user ID, if any.
    
docstring: Gets the requestor's user info from a cookie dictionary.
docstring_tokens: Gets the requestor ' s user info from a cookie dictionary .
code: def _get_user_info_from_dict(cookie_dict, cookie_name=_COOKIE_NAME):
    """Gets the requestor's user info from a cookie dictionary.
  
    Args:
      cookie_dict: A dictionary mapping cookie names onto values.
      cookie_name: The name of the cookie that stores the user info.
  
    Returns:
      A tuple (email, admin, user_id) where:
        email: The user's email address, if any.
        admin: True if the user is an admin; False otherwise.
        user_id: The user ID, if any.
    """
    cookie_secret = os.environ['COOKIE_SECRET']
  
    cookie_value = cookie_dict.get(cookie_name, '')
    cookie_value = cookie_value.replace("%3A",":")
    cookie_value = cookie_value.replace("%40",'@')
    cookie_value = cookie_value.replace("%2C",",")
  
    email, nickname, admin, hsh = (cookie_value.split(':') + ['', '', '', ''])[:4]
  
    if email == '':
      nickname = ''
      admin = ''
      return '', False, ''
    else:
      vhsh = sha.new(email+nickname+admin+cookie_secret).hexdigest()
      if hsh != vhsh:
        logging.info("{0} has an invalid cookie, so ignoring it.".format(email))
        return '', False, ''
  
    admin_apps = admin.split(',')
    current_app = os.environ['APPLICATION_ID']
    is_admin = current_app in admin_apps or CLOUD_ADMIN_MARKER in admin_apps
    return email, is_admin, nickname
code_tokens: def _get_user_info_from_dict ( cookie_dict , cookie_name = _COOKIE_NAME ) : cookie_secret = os . environ [ 'COOKIE_SECRET' ] cookie_value = cookie_dict . get ( cookie_name , '' ) cookie_value = cookie_value . replace ( "%3A" , ":" ) cookie_value = cookie_value . replace ( "%40" , '@' ) cookie_value = cookie_value . replace ( "%2C" , "," ) email , nickname , admin , hsh = ( cookie_value . split ( ':' ) + [ '' , '' , '' , '' ] ) [ : 4 ] if email == '' : nickname = '' admin = '' return '' , False , '' else : vhsh = sha . new ( email + nickname + admin + cookie_secret ) . hexdigest ( ) if hsh != vhsh : logging . info ( "{0} has an invalid cookie, so ignoring it." . format ( email ) ) return '' , False , '' admin_apps = admin . split ( ',' ) current_app = os . environ [ 'APPLICATION_ID' ] is_admin = current_app in admin_apps or CLOUD_ADMIN_MARKER in admin_apps return email , is_admin , nickname
short_docstring: Gets the requestor's user info from a cookie dictionary.
short_docstring_tokens: Gets the requestor ' s user info from a cookie dictionary .
comment: """Gets the requestor's user info from a cookie dictionary.
  
    Args:
      cookie_dict: A dictionary mapping cookie names onto values.
      cookie_name: The name of the cookie that stores the user info.
  
    Returns:
      A tuple (email, admin, user_id) where:
        email: The user's email address, if any.
        admin: True if the user is an admin; False otherwise.
        user_id: The user ID, if any.
    """