Пример #1
0
 def get_content_type(self):
     try:
         h = self.get_headers()
         ct_str = h.get('content-type')
         ct = gmimelib.string_to_content_type(ct_str)
         return (ct.get_media_type(), ct.get_media_subtype())
     except HeaderNameError:
         return None
Пример #2
0
 def get_content_type(self):
     try:
         h = self.get_headers()
         ct_str = h.get('content-type')
         ct = gmimelib.string_to_content_type(ct_str)
         return (ct.get_media_type(), ct.get_media_subtype())
     except HeaderNameError:
         return None
Пример #3
0
 def get_parameters(self):
     try:
         h = self.get_headers()
         ct_str = h.get('content-type')
         ct = gmimelib.string_to_content_type(ct_str)
         def paramgen(content_type):
             param = content_type.get_params()
             while not param._is_null():
                 yield (param.get_name(), param.get_value())
                 param = param.next()
         return paramgen(ct)
     except HeaderNameError:
         return None
Пример #4
0
    def get_parameters(self):
        try:
            h = self.get_headers()
            ct_str = h.get('content-type')
            ct = gmimelib.string_to_content_type(ct_str)

            def paramgen(content_type):
                param = content_type.get_params()
                while not param._is_null():
                    yield (param.get_name(), param.get_value())
                    param = param.next()

            return paramgen(ct)
        except HeaderNameError:
            return None