changeset 32:a0a147409f67

fixed bug if mapping doesn't exist.
author casties
date Tue, 11 Dec 2012 16:05:50 -0500
parents ab58edfc0707
children 1f845c76dad3
files MetaData.py
diffstat 1 files changed, 2 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/MetaData.py	Mon Oct 01 18:17:29 2012 +0200
+++ b/MetaData.py	Tue Dec 11 16:05:50 2012 -0500
@@ -267,7 +267,7 @@
     def getMappedData(self, data, allFields=False):
         """returns dict with metadata descriptions and data for data"""
         fields = self.getMapFields(data)
-        fieldList = fields['@fieldList']
+        fieldList = fields.get('@fieldList', [])
         mappedData = {}
         mappedList = []
         for bk in fieldList:
@@ -288,12 +288,11 @@
                 if bk in mappedData or not data[bk] or bk[0]=='@':
                     continue
                 
-                
                 mappedData[bk] = {'tag':bk, 'label':bk, 'value':data[bk]}
                 mappedList.append(bk)
                 
         mappedData['@fieldList'] = mappedList
-        mappedData['@type'] = data.get('@type',None)
+        mappedData['@type'] = data.get('@type', None)
         return mappedData
     
     def getDCMappedData(self, data, allFields=False):