def import_locations_async(domain, file_ref_id): importer = MultiExcelImporter(import_locations_async, file_ref_id) results = list(import_locations(domain, importer)) importer.mark_complete() return { 'messages': results }
def import_locations_async(domain, file_ref_id): importer = MultiExcelImporter(import_locations_async, file_ref_id) results = list(import_locations(domain, importer)) importer.mark_complete() return { 'messages': results }
def import_locations_async(download_id, domain, file_ref_id, update_existing=False): """ Asynchronously import locations. download_id is for showing the results to the user through soil. file_ref_id is also a download_id, but should be a pointer to the import file. """ download_ref = DownloadBase.get(file_ref_id) with open(download_ref.get_filename(), 'rb') as f: results_msg = '\n'.join(import_locations(domain, f, update_existing)) ref = expose_download(results_msg, 60*60*3) cache.set(download_id, ref)
def import_locations_async(domain, file_ref_id): importer = MultiExcelImporter(import_locations_async, file_ref_id) task = import_locations_async DownloadBase.set_progress(task, 0, 100) if NEW_BULK_LOCATION_MANAGEMENT.enabled(domain): results = new_locations_import(domain, importer) else: results = list(import_locations(domain, importer)) DownloadBase.set_progress(task, 100, 100) importer.mark_complete() return {'messages': results}
def import_locations_async(domain, file_ref_id): task = import_locations_async DownloadBase.set_progress(task, 0, 100) download_ref = DownloadBase.get(file_ref_id) workbook = WorkbookJSONReader(download_ref.get_filename()) worksheets = workbook.worksheets results = list(import_locations(domain, worksheets, task)) DownloadBase.set_progress(task, 100, 100) return {'messages': results}
def import_locations_async(domain, file_ref_id): task = import_locations_async DownloadBase.set_progress(task, 0, 100) download_ref = DownloadBase.get(file_ref_id) workbook = WorkbookJSONReader(download_ref.get_filename()) worksheets = workbook.worksheets results = list(import_locations(domain, worksheets, task)) DownloadBase.set_progress(task, 100, 100) return { 'messages': results }