diff --git a/src/pyDataverse/__init__.py b/src/pyDataverse/__init__.py index 9a9f0cc..9e2f844 100644 --- a/src/pyDataverse/__init__.py +++ b/src/pyDataverse/__init__.py @@ -16,7 +16,7 @@ __email__ = 'stefan.kasberger@univie.ac.at' __copyright__ = 'Copyright (c) 2019 Stefan Kasberger' __license__ = 'MIT License' -__version__ = '0.2.0' +__version__ = '0.2.1' __url__ = 'https://github.com/AUSSDA/pyDataverse' __download_url__ = 'https://pypi.python.org/pypi/pyDataverse' __description__ = 'A Python module for Dataverse.' diff --git a/src/pyDataverse/models.py b/src/pyDataverse/models.py index f5fead2..79207f9 100644 --- a/src/pyDataverse/models.py +++ b/src/pyDataverse/models.py @@ -946,19 +946,17 @@ def dict(self, format='dv_up'): }) # Generate series attributes - if self.__getattribute__('series') is not None: + if self.__getattribute__('seriesName') is not None or self.__getattribute__('seriesInformation') is not None: tmp_dict = {} tmp_dict['value'] = {} - if 'seriesName' in self.__getattribute__('series'): - if self.__getattribute__('seriesName') is not None: - tmp_dict['value']['seriesName'] = {} - tmp_dict['value']['seriesName']['typeName'] = 'seriesName' - tmp_dict['value']['seriesName']['value'] = self.__getattribute__('seriesName') - if 'seriesInformation' in self.__getattribute__('series'): - if self.__getattribute__('seriesInformation') is not None: - tmp_dict['value']['seriesInformation'] = {} - tmp_dict['value']['seriesInformation']['typeName'] = 'seriesInformation' - tmp_dict['value']['seriesInformation']['value'] = self.__getattribute__('seriesInformation') + if self.__getattribute__('seriesName') is not None: + tmp_dict['value']['seriesName'] = {} + tmp_dict['value']['seriesName']['typeName'] = 'seriesName' + tmp_dict['value']['seriesName']['value'] = self.__getattribute__('seriesName') + if self.__getattribute__('seriesInformation') is not None: + tmp_dict['value']['seriesInformation'] = {} + tmp_dict['value']['seriesInformation']['typeName'] = 'seriesInformation' + tmp_dict['value']['seriesInformation']['value'] = self.__getattribute__('seriesInformation') citation['fields'].append({ 'typeName': 'series', 'value': tmp_dict @@ -992,7 +990,7 @@ def dict(self, format='dv_up'): }) # Generate targetSampleSize attributes - if self.__getattribute__('targetSampleSize') is not None: + if self.__getattribute__('targetSampleActualSize') is not None or self.__getattribute__('targetSampleSizeFormula') is not None: tmp_dict = {} tmp_dict['value'] = {} if 'targetSampleActualSize' in self.__getattribute__('targetSampleSize'): @@ -1006,31 +1004,28 @@ def dict(self, format='dv_up'): tmp_dict['value']['targetSampleSizeFormula']['typeName'] = 'targetSampleSizeFormula' tmp_dict['value']['targetSampleSizeFormula']['value'] = self.__getattribute__('targetSampleSizeFormula') socialscience['fields'].append({ - 'typeName': 'series', + 'typeName': 'targetSampleSize', 'value': tmp_dict }) # Generate socialScienceNotes attributes - if self.__getattribute__('socialScienceNotes') is not None: + if self.__getattribute__('socialScienceNotesType') is not None or self.__getattribute__('socialScienceNotesSubject') is not None or self.__getattribute__('socialScienceNotesText') is not None: tmp_dict = {} tmp_dict['value'] = {} - if 'socialScienceNotesType' in self.__getattribute__('socialScienceNotes'): - if self.__getattribute__('socialScienceNotesType') is not None: - tmp_dict['value']['socialScienceNotesType'] = {} - tmp_dict['value']['socialScienceNotesType']['typeName'] = 'socialScienceNotesType' - tmp_dict['value']['socialScienceNotesType']['value'] = self.__getattribute__('socialScienceNotesType') - if 'socialScienceNotesSubject' in self.__getattribute__('socialScienceNotes'): - if self.__getattribute__('socialScienceNotesSubject') is not None: - tmp_dict['value']['socialScienceNotesSubject'] = {} - tmp_dict['value']['socialScienceNotesSubject']['typeName'] = 'socialScienceNotesSubject' - tmp_dict['value']['socialScienceNotesSubject']['value'] = self.__getattribute__('socialScienceNotesSubject') - if 'socialScienceNotesText' in self.__getattribute__('socialScienceNotes'): - if self.__getattribute__('socialScienceNotesText') is not None: - tmp_dict['value']['socialScienceNotesText'] = {} - tmp_dict['value']['socialScienceNotesText']['typeName'] = 'socialScienceNotesText' - tmp_dict['value']['socialScienceNotesText']['value'] = self.__getattribute__('socialScienceNotesText') + if self.__getattribute__('socialScienceNotesType') is not None: + tmp_dict['value']['socialScienceNotesType'] = {} + tmp_dict['value']['socialScienceNotesType']['typeName'] = 'socialScienceNotesType' + tmp_dict['value']['socialScienceNotesType']['value'] = self.__getattribute__('socialScienceNotesType') + if self.__getattribute__('socialScienceNotesSubject') is not None: + tmp_dict['value']['socialScienceNotesSubject'] = {} + tmp_dict['value']['socialScienceNotesSubject']['typeName'] = 'socialScienceNotesSubject' + tmp_dict['value']['socialScienceNotesSubject']['value'] = self.__getattribute__('socialScienceNotesSubject') + if self.__getattribute__('socialScienceNotesText') is not None: + tmp_dict['value']['socialScienceNotesText'] = {} + tmp_dict['value']['socialScienceNotesText']['typeName'] = 'socialScienceNotesText' + tmp_dict['value']['socialScienceNotesText']['value'] = self.__getattribute__('socialScienceNotesText') socialscience['fields'].append({ - 'typeName': 'series', + 'typeName': 'socialScienceNotes', 'value': tmp_dict })