fix: respect rejected batch import receipts
This commit is contained in:
1 parent
eda9403d94
commit
de16bbdfa1
3 files changed
+18
-1
No files matched your search
@@ -56,7 +56,13 @@ def import_pairs(service, task_id, pairs, *, request_id, stop_event, on_progress
|
||||
receipt = service.import_pair(task_id, before, after,
|
||||
request_id='batch-row:'+digest([request_id, index, before, after]), stop_event=stop_event,
|
||||
display_name=names[index])
|
||||
row.update(status='imported', receipt=receipt)
|
||||
if receipt['accepted'] or receipt['duplicates']:
|
||||
row.update(status='imported', receipt=receipt)
|
||||
else:
|
||||
reason = ';'.join(r['reason'] for r in receipt['rejected']) or '工程未被任务接收。'
|
||||
if names[index] is not None and len(names[index])>256:
|
||||
reason = '相对路径超过256字符,请缩短目录层级或使用“添加工程对”。'
|
||||
row.update(status='failed', reason=reason, receipt=receipt)
|
||||
except TaskCenterError as error:
|
||||
if error.code == 'operation_cancelled':
|
||||
result['cancelled'] = True
|
||||
|
||||
Reference in new issue
Block a user