#NEWLINE# def _ebMX( self , failure , domain ) : #NEWLINE# #INDENT# from twisted.names import error , dns #NEWLINE# if self . fallbackToDomain : #NEWLINE# #INDENT# failure . trap ( error . DNSNameError ) #NEWLINE# log . msg ( ( 'MX lookup failed; attempting to use hostname (%s) directly' % ( domain , ) ) ) #NEWLINE# d = self . resolver . getHostByName ( domain ) #NEWLINE# def cbResolved( addr ) : #NEWLINE# #INDENT# return dns . Record_MX ( name = addr ) #NEWLINE# #UNINDENT# def ebResolved( err ) : #NEWLINE# #INDENT# err . trap ( error . DNSNameError ) #NEWLINE# raise DNSLookupError ( ) #NEWLINE# #UNINDENT# d . addCallbacks ( cbResolved , ebResolved ) #NEWLINE# return d #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if failure . check ( error . DNSNameError ) : #NEWLINE# #INDENT# raise IOError ( ( 'No MX found for %r' % ( domain , ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# return cbResolved