mirror of https://github.com/dirtbags/moth.git
Do better checking for fields that may be empty or unset
This commit is contained in:
parent
470e01b437
commit
51124ec80b
|
@ -71,7 +71,9 @@ class MothValidator:
|
|||
def check_fields(self, puzzle):
|
||||
"""Check if the puzzle has the requested fields"""
|
||||
for field in self.required_fields:
|
||||
if not hasattr(puzzle, field):
|
||||
if not hasattr(puzzle, field) or \
|
||||
getattr(puzzle,field) is None or \
|
||||
getattr(puzzle,field) == "":
|
||||
raise MothValidationError("Missing field %s" % (field,))
|
||||
|
||||
@staticmethod
|
||||
|
|
Loading…
Reference in New Issue