Hallo zusammen, kann mir jemand ausführlich sagen was diese Funktion macht? Ich weiss, das sie für den Inhaltsvergleich zuständig ist der zuvor definiert worden ist. Ich sollte aber nun wissen was dieser Teil genau macht?
Vielen Dank für eure Antworten
Alles anzeigen
Vielen Dank für eure Antworten
Quellcode
- 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