Esempio n. 1
0
    def __init__(self, outfp, headers = [], skip = True):
        """
        A generator that prints out only headers. If 'skip' is true,
        then headers in the list 'headers' are NOT included in the
        output.

        If skip is False then only headers in the list 'headers' are
        included in the output.

        The default of headers = [] and skip = True will cause all
        headers to be printed.

        NOTE: Headers are compared in a case insensitive fashion so
        'bCc' and 'bCC' and 'bcc' are all the same.
        """
        self.log = logging.getLogger("%s.%s" % (__name__, self.__class__.__name__))
        Generator.__init__(self, outfp)
        self._headers = [x.lower() for x in headers]
        self._skip = skip
Esempio n. 2
0
    def __init__(self, outfp, headers=False):
        """
        This is a special purpose message generator.

        We need a generator that can be used to represent the 'TEXT'
        fetch attribute. When used on a multipart message it does not
        render the headers of the message, but renders the headers of
        every sub-part.

        When used on a message that is not a multipart it just renders
        the body.

        We do this by having the 'clone()' method basically reverse
        whether or not we should print the headers, and the _write()
        method looks at that instance variable to decide if it should
        print the headers or not.

        outfp is the output file-like object for writing the message to.  It
        must have a write() method.

        """
        Generator.__init__(self, outfp)
        self._headers = headers
Esempio n. 3
0
 def __init__(self, outfp, mangle_from_=True, maxheaderlen=78, write_headers=True):
     self.write_headers = write_headers
     Generator.__init__(self, outfp, mangle_from_, maxheaderlen)
Esempio n. 4
0
 def __init__(self, outfp, headers=[], skip=True):
     self.log = logging.getLogger("%s.%s" % (__name__,
                                             self.__class__.__name__))
     Generator.__init__(self, outfp)
     self._headers = [x.lower() for x in headers]
     self._skip = skip
Esempio n. 5
0
 def __init__(self, outfp, mangle_from_=True, maxheaderlen=78):
     Generator.__init__(self, outfp, mangle_from_, maxheaderlen)
     self._headertxt = ''
Esempio n. 6
0
 def __init__(self, outfp, mangle_from_=True,
              maxheaderlen=78, skipheaders=True):
     Generator.__init__(self, outfp, mangle_from_=False)
     self.__skipheaders = skipheaders