Exception handling

This commit is contained in:
Rémi Oudin 2018-02-26 15:15:03 +01:00
parent bdfa285e6b
commit 5d4bd30e20

View file

@ -9,6 +9,7 @@ from math import floor
from xml.etree import ElementTree as ET from xml.etree import ElementTree as ET
from datetime import datetime from datetime import datetime
from django.db import models from django.db import models
from django.core.exceptions import ValidationError
import profiles.models as profiles import profiles.models as profiles
from crawl import crawl from crawl import crawl
from pinocchio.settings import HISTORY_MIN from pinocchio.settings import HISTORY_MIN
@ -239,7 +240,10 @@ def generate_history(user, start_time):
timestamp=datetime.fromtimestamp(timestamp), timestamp=datetime.fromtimestamp(timestamp),
history=history history=history
) )
try:
new_line.full_clean() new_line.full_clean()
new_line.save() new_line.save()
except ValidationError:
pass
return history return history