Skip to content

Commit

Permalink
Unbreak the add verb from #385. (#396, part 1)
Browse files Browse the repository at this point in the history
  • Loading branch information
dbaron committed Jul 20, 2020
1 parent 8d7d933 commit d62ec4d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions activities.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def save(self):

def append(self, spec_entry):
"Append a SpecEntry to self.data. Raises ValueError if it's malformed."
errors = self.validate_entry(spec_entry.data)
errors = self.validate_entry(spec_entry.data, is_adding=True)
if errors:
raise ValueError(errors)
self.data.append(spec_entry.data)
Expand Down Expand Up @@ -160,7 +160,7 @@ def validate(self, check_sorting):
prevTitle = title
return errors

def validate_entry(self, entry, title=None):
def validate_entry(self, entry, title=None, is_adding=False):
"""
Validate a single entry.
Expand All @@ -171,7 +171,7 @@ def validate_entry(self, entry, title=None):
errors = []
for (name, required, value_type) in self.expected_entry_items:
entry_value = entry.get(name, None)
if required and entry_value is None:
if required and not is_adding and entry_value is None:
errors.append("%s doesn't have required member %s" % (title, name))
else:
if entry_value is None:
Expand Down

0 comments on commit d62ec4d

Please sign in to comment.