From a8a26b5f049ee31275a49968838d6fc44938c81c Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Tue, 14 Jul 2020 17:20:49 -0700 Subject: [PATCH] Unbreak the `add` verb from #385. (#396, part 1) --- activities.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/activities.py b/activities.py index c97a55ab..63f489f5 100755 --- a/activities.py +++ b/activities.py @@ -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) @@ -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. @@ -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: