def get(self, res_id): local_data = ResourceLocalData(res_id) if not local_data.is_downloaded(): resource_manager.save_resource_locally(res_id) self.write({ 'readMe': local_data.get_readme(), 'rootDir': local_data.get_files_and_folders(), })
def get(self, res_id): # Handling authentication first to ensure local data if not present is downloaded from Hydroshare if not resource_manager.is_authenticated(): self.write({ 'success': False, 'error': HYDROSHARE_AUTHENTICATION_ERROR, }) return local_data = ResourceLocalData(res_id) if not local_data.is_downloaded(): resource_manager.save_resource_locally(res_id) self.write({ 'readMe': local_data.get_readme(), 'rootDir': local_data.get_files_and_folders(), })
def get(self, res_id): if not resource_manager.is_authenticated(): self.write({ 'success': False, 'error': HYDROSHARE_AUTHENTICATION_ERROR, }) return local_data = ResourceLocalData(res_id) if not local_data.is_downloaded(): self.write({ 'success': False, 'error': WORKSPACE_FILES_ERROR, # 'error' : 'HydroShare files not present in Workspace', }) return else: local_file_data = local_data.get_files_and_folders() # checkFileSyncStatus(temporaryRoot, res_id) checkHydroShareSyncStatus(local_file_data, res_id, True) self.write({ 'readMe': local_data.get_readme(), 'rootDir': local_file_data, })