Skip to content
This repository was archived by the owner on Dec 12, 2024. It is now read-only.

Commit 6cc6683

Browse files
committed
Fixes #15 but will require mod to GWSS code
1 parent d9359a3 commit 6cc6683

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

batch_loader.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@ def create_repository_metadata(row, singular_field_names, repeating_field_names)
7777

7878

7979
def find_files(row_filepath, row_first_filepath, base_filepath):
80+
if row_filepath is '':
81+
# We will interpret this as "No files to load or update"
82+
print("row_filepath is None")
83+
return None, None
84+
8085
filepath = os.path.join(base_filepath, row_filepath)
8186
if not os.path.exists(filepath):
8287
raise FileNotFoundError(filepath)
@@ -111,13 +116,16 @@ def repo_import(repo_metadata_filepath, title, first_file, other_files, reposito
111116
# rake gwss:ingest_etd -- --manifest='path-to-manifest-json-file' --primaryfile='path-to-primary-attachment-file/myfile.pdf' --otherfiles='path-to-all-other-attachments-folder'
112117
command = ingest_command.split(' ') + ['--',
113118
'--manifest=%s' % repo_metadata_filepath,
114-
'--primaryfile=%s' % first_file,
115119
'--depositor=%s' % ingest_depositor]
120+
if first_file:
121+
command.extend(['--primaryfile=%s' % first_file])
116122
if other_files:
117123
command.extend(['--otherfiles=%s' % ','.join(other_files)])
118124
if repository_id:
119125
log.info('%s is an update.', title)
120126
command.extend(['--update-item-id=%s' % repository_id])
127+
if first_file is None:
128+
command.extend(['--skip-file-updates'])
121129
log.info("Command is: %s" % ' '.join(command))
122130
output = subprocess.check_output(command, cwd=ingest_path)
123131
repository_id = output.decode('utf-8').rstrip('\n')

0 commit comments

Comments
 (0)