예제 #1
0
 def parse(cls, value, kwds):
     kwds['parse_tree'] = parse_tree = cls.value_parser(value)
     kwds['decoded'] = str(parse_tree)
     kwds['defects'].extend(parse_tree.all_defects)
     if parse_tree.params is None:
         kwds['params'] = {}
     else:
         # The MIME RFCs specify that parameter ordering is arbitrary.
         kwds['params'] = dict((utils._sanitize(name).lower(),
                                utils._sanitize(value))
                               for name, value in parse_tree.params)
예제 #2
0
 def parse(cls, value, kwds):
     kwds['parse_tree'] = parse_tree = cls.value_parser(value)
     kwds['decoded'] = str(parse_tree)
     kwds['defects'].extend(parse_tree.all_defects)
     if parse_tree.params is None:
         kwds['params'] = {}
     else:
         # The MIME RFCs specify that parameter ordering is arbitrary.
         kwds['params'] = dict((utils._sanitize(name).lower(),
                                utils._sanitize(value))
                               for name, value in parse_tree.params)
예제 #3
0
 def __new__(cls, name, value):
     kwds = {'defects': []}
     cls.parse(value, kwds)
     if utils._has_surrogates(kwds['decoded']):
         kwds['decoded'] = utils._sanitize(kwds['decoded'])
     self = str.__new__(cls, kwds['decoded'])
     # del kwds['decoded']
     self.init(name, **kwds)
     return self
예제 #4
0
 def __new__(cls, name, value):
     kwds = {'defects': []}
     cls.parse(value, kwds)
     if utils._has_surrogates(kwds['decoded']):
         kwds['decoded'] = utils._sanitize(kwds['decoded'])
     self = str.__new__(cls, kwds['decoded'])
     # del kwds['decoded']
     self.init(name, **kwds)
     return self
예제 #5
0
 def init(self, *args, **kw):
     super().init(*args, **kw)
     self._cte = utils._sanitize(self._parse_tree.cte)
예제 #6
0
 def init(self, *args, **kw):
     super().init(*args, **kw)
     cd = self._parse_tree.content_disposition
     self._content_disposition = cd if cd is None else utils._sanitize(cd)
예제 #7
0
 def init(self, *args, **kw):
     super().init(*args, **kw)
     self._maintype = utils._sanitize(self._parse_tree.maintype)
     self._subtype = utils._sanitize(self._parse_tree.subtype)
예제 #8
0
 def init(self, *args, **kw):
     super().init(*args, **kw)
     self._cte = utils._sanitize(self._parse_tree.cte)
예제 #9
0
 def init(self, *args, **kw):
     super().init(*args, **kw)
     cd = self._parse_tree.content_disposition
     self._content_disposition = cd if cd is None else utils._sanitize(cd)
예제 #10
0
 def init(self, *args, **kw):
     super().init(*args, **kw)
     self._maintype = utils._sanitize(self._parse_tree.maintype)
     self._subtype = utils._sanitize(self._parse_tree.subtype)