# HG changeset patch # User casties # Date 1454429632 -3600 # Node ID 9a9a6da1d41581269df5c13312616ff0ec887daa # Parent d535f11a0d81264acf23f5b8c03f0e48dd3ca488 reorder code a bit. diff -r d535f11a0d81 -r 9a9a6da1d415 importFromOpenMind/importer/ismi2model.py --- 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']