mdph13: only validate valued date fields (#31279)

This commit is contained in:
Benjamin Dauvergne 2019-03-11 16:18:33 +01:00
parent b8b8d140f6
commit 52522274e6
2 changed files with 3 additions and 3 deletions

View File

@ -157,8 +157,8 @@ class MDPH13Resource(BaseResource, HTTPResource):
def check(value, path):
if path[-1].startswith('date_'):
if (not isinstance(value, six.text_type)
or not self.DATE_RE.match(value)):
if (isinstance(value, six.text_type)
and not self.DATE_RE.match(value)):
errors.append('%s is not a date string' % '.'.join(path))
json_walker(data, check)
if errors:

View File

@ -93,7 +93,7 @@ VALID_RESPONSE = json.dumps({
"prestation": "Carte d'invalidité (de priorité) pour personne handicapée",
"statut": "Instruction administrative terminée en attente de passage en évaluation",
"typologie": "Demande En Cours",
"date_decision": "2015-01-16"
"date_decision": None,
},
{
"numero": "1210524",