Guénaël Muller 6 lat temu
rodzic
commit
d2540126b9
1 zmienionych plików z 6 dodań i 6 usunięć
  1. 6 6
      tracim/tracim/lib/email_body_parser.py

+ 6 - 6
tracim/tracim/lib/email_body_parser.py Wyświetl plik

@@ -39,7 +39,6 @@ class BodyMailParts(object):
39 39
         # say "all elem after me is Signature"
40 40
         self.follow = False
41 41
 
42
-
43 42
     def __len__(self) -> int:
44 43
         return len(self._list)
45 44
 
@@ -55,9 +54,9 @@ class BodyMailParts(object):
55 54
         self._append(value)
56 55
 
57 56
     def _append(self, value) -> None:
58
-        same_type_as_last =len(self._list) > 0 and \
59
-                           self._list[-1].part_type == value.part_type
60
-        if same_type_as_last or self.follow :
57
+        same_type_as_last = len(self._list) > 0 and \
58
+                            self._list[-1].part_type == value.part_type
59
+        if same_type_as_last or self.follow:
61 60
             self._list[-1].text += value.text
62 61
         else:
63 62
             self._list.append(value)
@@ -215,7 +214,7 @@ class HtmlMailSignatureChecker(HtmlChecker):
215 214
             for child in elem.children:
216 215
                 if cls._has_attr_value(child, 'class', 'gmail_signature'):
217 216
                     return True
218
-        if isinstance(elem,Tag) and elem.name.lower() == 'div':
217
+        if isinstance(elem, Tag) and elem.name.lower() == 'div':
219 218
             for child in elem.children:
220 219
                 if cls._has_attr_value(child, 'class', 'gmail_signature'):
221 220
                     return True
@@ -230,6 +229,7 @@ class HtmlMailSignatureChecker(HtmlChecker):
230 229
             return True
231 230
         return False
232 231
 
232
+
233 233
 class ParsedHTMLMail(object):
234 234
     """
235 235
     Parse HTML Mail depending of some rules.
@@ -280,7 +280,7 @@ class ParsedHTMLMail(object):
280 280
             # Hack - G.M - 2017-11-28 : remove tag with no enclosure
281 281
             # <br> and <hr> tag alone broke html.parser tree,
282 282
             # Using another parser may be a solution.
283
-            if tag.name.lower() in ['br','hr']:
283
+            if tag.name.lower() in ['br', 'hr']:
284 284
                 tag.unwrap()
285 285
                 continue
286 286
             if tag.name.lower() in ['script', 'style']: