def get_profile_from_cookie_key_value(cookie_key, cookie_value): """ Communicate with Facebook to get a FB profile associated with the specific cookie value. Because this talks to Facebook via an HTTP request, this is cached in memcache to avoid constant communication while a FB user is browsing the site. If we encounter an error or fail to load a Facebook profile, the results are not cached in memcache. However, we also cache in request_cache because if we fail to load a Facebook profile, we only want to do that once per request. """ fb_auth_dict = facebook.get_user_from_cookie_patched( {cookie_key: cookie_value}, App.facebook_app_id, App.facebook_app_secret) if fb_auth_dict: profile = _get_profile_from_fb_token(fb_auth_dict["access_token"]) if profile: return profile # Don't cache any missing results in memcache return layer_cache.UncachedResult(None)
def get_profile_from_cookie_key_value(cookie_key, cookie_value): """ Communicate with Facebook to get a FB profile associated with the specific cookie value. Because this talks to Facebook via an HTTP request, this is cached in memcache to avoid constant communication while a FB user is browsing the site. If we encounter an error or fail to load a Facebook profile, the results are not cached in memcache. However, we also cache in request_cache because if we fail to load a Facebook profile, we only want to do that once per request. """ fb_auth_dict = facebook.get_user_from_cookie_patched( { cookie_key: cookie_value }, App.facebook_app_id, App.facebook_app_secret) if fb_auth_dict: profile = _get_profile_from_fb_token(fb_auth_dict["access_token"]) if profile: return profile # Don't cache any missing results in memcache return layer_cache.UncachedResult(None)
def get_profile_from_cookie_key_value(cookie_key, cookie_value): fb_auth_dict = facebook.get_user_from_cookie_patched( {cookie_key: cookie_value}, App.facebook_app_id, App.facebook_app_secret) if fb_auth_dict: profile = get_profile_from_fb_token(fb_auth_dict["access_token"]) if profile: return profile # Don't cache any missing results return layer_cache.UncachedResult(None)
def get_profile_from_cookie_key_value(cookie_key, cookie_value): fb_auth_dict = facebook.get_user_from_cookie_patched( { cookie_key: cookie_value }, App.facebook_app_id, App.facebook_app_secret) if fb_auth_dict: profile = get_profile_from_fb_token(fb_auth_dict["access_token"]) if profile: return profile # Don't cache any missing results return layer_cache.UncachedResult(None)