Skip to content

Commit 2e7181c

Browse files
committed
Small change to handle old, bad test records
1 parent 84b3719 commit 2e7181c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

caltechdata_api/decustomize_schema.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,9 @@ def decustomize_schema(json_record,pass_emails=False,pass_media=False):
130130

131131
#set publicationYear
132132
if 'publicationDate' in json_record:
133-
year = json_record['publicationDate'].split('-')[0]
134-
json_record['publicationYear'] = year
133+
if isinstance(json_record['publicationDate'],str):
134+
year = json_record['publicationDate'].split('-')[0]
135+
json_record['publicationYear'] = year
135136

136137
#If "Submitted' date type was not manually set in metadata
137138
#Or 'Issued was not manually set

0 commit comments

Comments
 (0)