From 377958e8b13061042cecdafd913745029b77684a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Wed, 2 May 2012 13:28:47 +0200 Subject: [PATCH] handle ministry:college as a correct value for authors --- themis/importexport/sync.py | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/themis/importexport/sync.py b/themis/importexport/sync.py index cd82963..18ac12e 100644 --- a/themis/importexport/sync.py +++ b/themis/importexport/sync.py @@ -284,16 +284,23 @@ class SyncFromThemis(UtilityView): continue related_docs.append(self.intids.getId(related_doc)) object.related_docs = [RelationValue(x) for x in related_docs if x] + + authors_v = None if data.get('auteur'): - value = data.get('auteur') - if type(value) is list: - authors = [self.get_author_intid(x) for x in value] - else: - authors = [self.get_author_intid(value)] - object.authors = [RelationValue(x) for x in authors if x] - if data.get('auteurs'): - authors = [self.get_author_intid(x) for x in data.get('auteurs')] - object.authors = [RelationValue(x) for x in authors if x] + authors_v = data.get('auteur') + if type(authors_v) is not list: + authors_v = [authors_v] + elif data.get('auteurs'): + authors_v = data.get('auteur') + if authors_v == ['ministry:college']: + object.author_is_government = True + elif authors_v: + authors_intids = [self.get_author_intid(x) for x in authors_v] + object.authors = [RelationValue(x) for x in author_intids if x] + object.author_is_government = False + else: + object.authors = None + object.author_is_government = False if data.get('etat_en_commission') and data.get('etat_en_commission') != u'Indéterminé': object.commission_status = data.get('etat_en_commission')