Vielen Dank für eure Antworten
Code: Alles auswählen
def CompareDefaultContents( api, incomingMessage, sentContentList ):
index = 0
missing = 0
mismatch = 0
missingErrMsg = 'Missing Content Types'
mismatchErrMsg = ' Dissimilar Content Types'
compareDetail = ''
compCrit = api.SetCompareCriteria( COMPARE_NAME, COMPARE_TYPE,\
COMPARE_LENGTH, TOLERANCE_PERCENTAGE )
for contentInfo in defaultContents:
contentType = contentInfo[0]
contentName = contentInfo[2]
try:
rcvdCont, detail = incomingMessage.SrchContentName( contentName )
except:
missing = 1
missingErrMsg += '\n' + str( contentType ) + ' named ' + str( contentName )
continue
try:
cmpResult, detail = rcvdCont.Compare( sentContentList[index],\
compCrit )
compareDetail += str( detail ) + '; '
except:
mismatch = 1
mismatchErrMsg += '\n' + str( contentType ) + ' named ' + str( contentName ) + '( '\
+ str( sys.exc_info()[1] ) + ' )'
index += 1
if missing or mismatch:
errMsg = ''
if missing:
errMsg += missingErrMsg + '; '
if mismatch:
errMsg += mismatchErrMsg + '; '
return FAILURE, errMsg
return SUCCESS, compareDetail