Mercurial > hg > drupalISMI
changeset 36:9a9a6da1d415
reorder code a bit.
author | casties |
---|---|
date | Tue, 02 Feb 2016 17:13:52 +0100 |
parents | d535f11a0d81 |
children | eccbb6239b89 |
files | importFromOpenMind/importer/ismi2model.py |
diffstat | 1 files changed, 9 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/importFromOpenMind/importer/ismi2model.py Tue Feb 02 16:54:03 2016 +0100 +++ b/importFromOpenMind/importer/ismi2model.py Tue Feb 02 17:13:52 2016 +0100 @@ -105,16 +105,7 @@ # exclude attribute continue - # try date first since some date attributes have the wrong type - if ct == 'date': - # date attribute - val = att['ov'] - # try to parse date object to get gregorian year - year = parseYear(val) - if year is not None: - attrs[name] = year - - elif ct is None or ct.lower() in ['text', 'arabic', 'bool', 'boolean', 'url', 'language']: + if ct is None or ct.lower() in ['text', 'arabic', 'bool', 'boolean', 'url', 'language']: # normal text attribute (assume no content_type is text too...) val = att['ov'] @@ -130,6 +121,14 @@ # add normalized value attrs['_n_'+name] = att['nov'] + elif ct == 'date': + # date attribute + val = att['ov'] + # try to parse date object to get gregorian year + year = parseYear(val) + if year is not None: + attrs[name] = year + elif ct == 'num': # number attribute val = att['ov']