Skip to content

Commit

Permalink
Add check on relative path when old location is None
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartmcalpine committed Oct 18, 2024
1 parent 9d2bb02 commit be2354c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/dataregistry/registrar/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ def _validate_register_inputs(
if i_char in name:
raise ValueError(f"Cannot have character {i_char} in name string")

# If no data is being copied from an `old_location`, `relative_path` is
# required
if kwargs_dict["old_location"] is None and kwargs_dict["location_type"] == "dataregistry" and kwargs_dict["relative_path"] is None:
raise ValueError("A `relative_path` must be passed when `old_location` is None "
"i.e., the data is assumed to be already within the `root_dir`")

# If external dataset, check for either a `url` or `contact_email`
if kwargs_dict["location_type"] == "external":
if kwargs_dict["url"] is None and kwargs_dict["contact_email"] is None:
Expand Down

0 comments on commit be2354c

Please sign in to comment.