Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
skasberger committed Jun 19, 2019
2 parents 950e042 + b501cfb commit 87d82ea
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 31 deletions.
2 changes: 1 addition & 1 deletion src/pyDataverse/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
__email__ = '[email protected]'
__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.'
55 changes: 25 additions & 30 deletions src/pyDataverse/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'):
Expand All @@ -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
})

Expand Down

0 comments on commit 87d82ea

Please sign in to comment.