def _getKeyNameBySchema(self, dataRoot, keyLoc, keyField):
     floatKey = getKeys(dataRoot, float)
     logging.debug('Total # of entry is %s' % len(floatKey))
     for ien in floatKey:
         if float(ien) <= 0:
             continue
         dataEntry = dataRoot[ien]
         index, loc = keyLoc.split(';')
         if not index or index not in dataEntry:
             continue
         dataEntry = dataEntry[index]
         if not dataEntry.value:
             return (ien, None)
         values = dataEntry.value.split('^')
         dataValue = None
         if convertToType(loc, int):
             intLoc = int(loc)
             if intLoc > 0 and intLoc <= len(values):
                 dataValue = values[intLoc - 1]
         else:
             dataValue = str(dataEntry.value)
         if dataValue:
             return (ien,
                     self._parseIndividualFieldDetail(
                         dataValue, keyField, None))
     return (None, None)
Пример #2
0
 def _parseSingleDataValueField(self, dataEntry, fieldAttr, outDataEntry):
   if not dataEntry.value:
     return
   values = dataEntry.value.split('^')
   location = fieldAttr.getLocation()
   dataValue = None
   if location:
     index, loc = location.split(';')
     if loc:
       if convertToType(loc, int):
         intLoc = int(loc)
         if intLoc > 0 and intLoc <= len(values):
           dataValue = values[intLoc-1]
       else:
         dataValue = str(dataEntry.value)
   else:
     dataValue = str(dataEntry.value)
   if dataValue:
     self._parseIndividualFieldDetail(dataValue, fieldAttr, outDataEntry)
Пример #3
0
 def _parseSingleDataValueField(self, dataEntry, fieldAttr, outDataEntry):
   if not dataEntry.value:
     return
   values = dataEntry.value.split('^')
   location = fieldAttr.getLocation()
   dataValue = None
   if location:
     index, loc = location.split(';')
     if loc:
       if convertToType(loc, int):
         intLoc = int(loc)
         if intLoc > 0 and intLoc <= len(values):
           dataValue = values[intLoc-1]
       else:
         dataValue = str(dataEntry.value)
   else:
     dataValue = str(dataEntry.value)
   if dataValue:
     self._parseIndividualFieldDetail(dataValue, fieldAttr, outDataEntry)
Пример #4
0
 def _getKeyNameBySchema(self, dataRoot, keyLoc, keyField):
   floatKey = getKeys(dataRoot, float)
   for ien in floatKey:
     if float(ien) <=0:
       continue
     dataEntry = dataRoot[ien]
     index, loc = keyLoc.split(';')
     if not index or index not in dataEntry:
       continue
     dataEntry = dataEntry[index]
     if not dataEntry.value:
       return (ien, None)
     values = dataEntry.value.split('^')
     dataValue = None
     if convertToType(loc, int):
       intLoc = int(loc)
       if intLoc > 0 and intLoc <= len(values):
         dataValue = values[intLoc-1]
     else:
       dataValue = str(dataEntry.value)
     if dataValue:
       return (ien, self._parseIndividualFieldDetail(dataValue, keyField, None))
   return (None, None)