def employer_resumes_download(request, extra_context=None): file_path = find_first_file(s.ZIPPED_RESUMES_DIRECTORY, "%s.*.zip" % s.ALL_ZIPPED_RESUMES_FILENAME_START) if file_path: mimetype = "application/zip" response = HttpResponse(file(file_path, "rb").read(), mimetype=mimetype) filename = file_path.split("/")[-1] response["Content-Disposition"] = 'attachment; filename="%s.zip"' % filename return response else: zip_resumes() return employer_resumes_download(request, extra_context)
def download_event_participant_resumes(request, event_id, extra_context=None): event = Event.objects.get(id=event_id) event_participant_resumes_directory_name = "%s (%d) All Participants" % (event.name, event.id) event_resumes_dir = "%sevent_resumes/" % (s.ZIPPED_RESUMES_DIRECTORY) if not os.path.exists(event_resumes_dir): os.makedirs(event_resumes_dir) file_path = find_first_file(event_resumes_dir, "%s.*.zip" % re.escape(event_participant_resumes_directory_name)) if file_path: mimetype = "application/zip" response = HttpResponse(file(file_path, "rb").read(), mimetype=mimetype) filename = file_path.split("/")[-1] response["Content-Disposition"] = 'attachment; filename="%s.zip"' % filename return response else: zip_resumes() return download_event_participant_resumes(request, event_id, extra_context)
def download_event_participant_resumes(request, event_id, extra_context=None): event = Event.objects.get(id=event_id) event_participant_resumes_directory_name = "%s (%d) All Participants" % ( event.name, event.id) event_resumes_dir = "%sevent_resumes/" % (s.ZIPPED_RESUMES_DIRECTORY) if not os.path.exists(event_resumes_dir): os.makedirs(event_resumes_dir) file_path = find_first_file( event_resumes_dir, "%s.*.zip" % re.escape(event_participant_resumes_directory_name)) if file_path: mimetype = "application/zip" response = HttpResponse(file(file_path, "rb").read(), mimetype=mimetype) filename = file_path.split("/")[-1] response[ "Content-Disposition"] = 'attachment; filename="%s.zip"' % filename return response else: zip_resumes() return download_event_participant_resumes(request, event_id, extra_context)