Skip to content

Commit 6f38933

Browse files
committed
Update schema default handling
1 parent 58da987 commit 6f38933

1 file changed

Lines changed: 18 additions & 14 deletions

File tree

caltechdata_api/caltechdata_write.py

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def caltechdata_write(
134134
token=None,
135135
files=[],
136136
production=False,
137-
schema="43",
137+
schema=None,
138138
publish=False,
139139
file_links=[],
140140
s3=None,
@@ -159,6 +159,21 @@ def caltechdata_write(
159159
if not token:
160160
token = os.environ["RDMTOK"]
161161

162+
if authors == False:
163+
if production == True:
164+
url = "https://data.caltech.edu/"
165+
elif local == True:
166+
url = "https://127.0.0.1:5000/"
167+
else:
168+
url = "https://data.caltechlibrary.dev/"
169+
else:
170+
if production == True:
171+
url = "https://authors.library.caltech.edu/"
172+
elif local == True:
173+
url = "https://127.0.0.1:5000/"
174+
else:
175+
url = "https://authors.caltechlibrary.dev/"
176+
162177
# If files is a string - change to single value array
163178
if isinstance(files, str) == True:
164179
files = [files]
@@ -208,22 +223,11 @@ def caltechdata_write(
208223
if "pids" not in metadata:
209224
metadata["pids"] = pids
210225

211-
if authors == False:
226+
if authors == False and schema == "43":
212227
data = customize_schema.customize_schema(metadata, schema=schema)
213-
if production == True:
214-
url = "https://data.caltech.edu/"
215-
elif local == True:
216-
url = "https://127.0.0.1:5000/"
217-
else:
218-
url = "https://data.caltechlibrary.dev/"
219228
else:
229+
# Using RDM schema, no customization
220230
data = metadata
221-
if production == True:
222-
url = "https://authors.library.caltech.edu/"
223-
elif local == True:
224-
url = "https://127.0.0.1:5000/"
225-
else:
226-
url = "https://authors.caltechlibrary.dev/"
227231

228232
headers = {
229233
"Authorization": "Bearer %s" % token,

0 commit comments

Comments
 (0)