Closed esturdivant-usgs closed 6 years ago
Tried to address in commit "Add publication date..."
if update_data: # Upload data files (FIXME: currently only shapefile)
#if metadata.findall(formname_tagpath)[0].text == 'Shapefile':
try: #FIXME: add this to a function in a more generalized way?
data_item["dates"][0]["dateString"]= new_values['pubdate']
To do this for all fields, we need to wipe the sb item before uploading the new xml. This can be done by creating a new JSON item with only the page ID and then using that in the call to sb.replace_file()
, sb.upload_files_and_upsert_item()
... Can use sb.updateSbItem(item)
or function get_fields_from_xml()
(probably too complicated).
# This deletes Related External Resources from item page
item = sb.get_item(item_id)
item['webLinks'] = None
item = sb.updateSbItem(item)
Also, links in Related External Resources (webLinks) were not updated.