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)
 return (email, is_admin, nickname)

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 ) return ( email , is_admin , nickname )
gets the requestors user info from a cookie dictionary .