Skip to content

Commit

Permalink
Set defaults for Serialization and Allow-Fetch.txt if not explicitly …
Browse files Browse the repository at this point in the history
…provided (#15)
  • Loading branch information
kba authored and ruebot committed Dec 10, 2018
1 parent 1403fb5 commit 036d7da
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion bagit_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,20 @@ def validate(self, bag):

def validate_bagit_profile(self, profile):
"""
Validate the profile itself.
Set default values for unspecified tags and validate the profile itself.
"""
if 'Serialization' not in profile:
profile['Serialization'] = 'optional'
if 'Allow-Fetch.txt' not in profile:
profile['Allow-Fetch.txt'] = True
self.validate_bagit_profile_info(profile)
self.validate_bagit_profile_accept_bagit_versions(profile)

# Check self.profile['bag-profile-info'] to see if "Source-Organization",
# "External-Description", "Version" and "BagIt-Profile-Identifier" are present.
def validate_bagit_profile_info(self, profile):
if 'BagIt-Profile-Info' not in profile:
self._fail("%s: Required 'BagIt-Profile-Info' dict is missing." % profile)
if 'Source-Organization' not in profile['BagIt-Profile-Info']:
self._fail("%s: Required 'Source-Organization' tag is not in 'BagIt-Profile-Info'." % profile)
if 'Version' not in profile['BagIt-Profile-Info']:
Expand Down

0 comments on commit 036d7da

Please sign in to comment.