def download_sample_obect_program(): file_name = 's3_object_key.txt' file_path = os.path.join(get_context_path(), 'private/Object_keys/' + file_name) logger.debug(file_path+"\n") response.headers['Content-Type'] = "text" response.headers['Content-Disposition']="attachment; filename=" +file_name try: return response.stream(get_file_stream(file_path),chunk_size=4096) except Exception: session.flash = "Unable to download your Keys." redirect(URL(r = request, c = 'user', f = 'list_my_object_store'))
def download_vpn_keys(): user_info=get_vpn_user_details() logger.debug(type(user_info)) user_name=user_info['username'] logger.debug(user_name+"\n") file_name = user_name+'_baadalVPN.tar' file_path = os.path.join(get_context_path(), 'private/VPN/' + file_name) logger.debug(file_path+"\n") #import contenttype as c response.headers['Content-Type'] = "application/zip" #response.headers['ContentType'] ="application/octet-stream"; response.headers['Content-Disposition']="attachment; filename=" +file_name logger.debug("******************************************************") try: return response.stream(get_file_stream(file_path),chunk_size=4096) except Exception: session.flash = "Unable to download your VPN files. Please Register first if you have not registered yet." redirect(URL(r = request, c = 'user', f = 'vpn'))
def download_object_keys(): #user_info=get_user_details() #user_name=user_info['username'].title() logger.debug(request.args[1]) # if '_' in request.args[1]: # user_name,b=request.args[1].split('_', 1) # else: # user_name=request.args[1] object_store_name=request.args[0] logger.debug(object_store_name) file_name = object_store_name+'_key.txt' file_path = os.path.join(get_context_path(), 'private/Object_keys/' + file_name) logger.debug(file_path+"\n") response.headers['Content-Type'] = "text" response.headers['Content-Disposition']="attachment; filename=" +file_name try: return response.stream(get_file_stream(file_path),chunk_size=4096) except Exception: session.flash = "Unable to download your Keys." redirect(URL(r = request, c = 'user', f = 'list_my_object_store'))