check for the existence of attributes before setting them

This commit is contained in:
Frédéric Péters 2012-05-02 13:19:44 +02:00
parent e5ab39d438
commit a19e61c526
1 changed files with 8 additions and 2 deletions

View File

@ -315,8 +315,14 @@ class SyncFromThemis(UtilityView):
object.seance_vote_date = None
if data.get('vote_seance') == u'Adoption':
object.adopted = True
object.adoption_date = DateTime(data.get('date_approbation_tutelle'))
object.moniteur_date = DateTime(data.get('date_publication_moniteur_belge'))
if data.get('date_approbation_tutelle'):
object.adoption_date = DateTime(data.get('date_approbation_tutelle'))
else:
object.adoption_date = None
if data.get('date_publication_moniteur_belge'):
object.moniteur_date = DateTime(data.get('date_publication_moniteur_belge'))
else:
object.moniteur_date = None
else:
object.adopted = False
object.adoption_date = None