def user_timezone_locale_prefs(request):
 cached_value = request_cache.get_cache(CACHE_NAME)
 if (not cached_value):
  user_prefs = {'user_timezone': None, 'user_language': None}
  if (hasattr(request, 'user') and request.user.is_authenticated()):
   try:
    user_preferences = get_user_preferences(request.user)
   except (UserNotFound, UserAPIInternalError):
    cached_value.update(user_prefs)
   else:
    user_prefs = {key: user_preferences.get(pref_name, None) for (key, pref_name) in RETRIEVABLE_PREFERENCES.iteritems()}
  cached_value.update(user_prefs)
 return cached_value

def user_timezone_locale_prefs ( request ) : cached_value = request_cache . get_cache ( CACHE_NAME ) if ( not cached_value ) : user_prefs = { 'user_timezone' : None , 'user_language' : None } if ( hasattr ( request , 'user' ) and request . user . is_authenticated ( ) ) : try : user_preferences = get_user_preferences ( request . user ) except ( UserNotFound , UserAPIInternalError ) : cached_value . update ( user_prefs ) else : user_prefs = { key : user_preferences . get ( pref_name , None ) for ( key , pref_name ) in RETRIEVABLE_PREFERENCES . iteritems ( ) } cached_value . update ( user_prefs ) return cached_value
checks if request has an authenticated user .