From d4aa07002a4b117230d9b3bc91421acc5e096815 Mon Sep 17 00:00:00 2001 From: Sergey Lavrinenko Date: Sun, 26 Apr 2015 17:03:37 +0300 Subject: [PATCH] Transformer.attribute_value is now public --- emails/transformer.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/emails/transformer.py b/emails/transformer.py index af9aa49..6b41678 100644 --- a/emails/transformer.py +++ b/emails/transformer.py @@ -212,12 +212,14 @@ class BaseTransformer(HTMLParser): return url - def _attribute_value(self, el): + def attribute_value(self, el): return el is not None \ and hasattr(el, 'attrib') \ and el.attrib.get(self.html_attribute_name) \ or None + _attribute_value = attribute_value # deprecated + def _default_attachment_check(self, el, hints): if hints['attrib'] == 'ignore': return False @@ -235,7 +237,7 @@ class BaseTransformer(HTMLParser): # Default callback: skip images with data-emails="ignore" attribute callback = lambda _, hints: hints['attrib'] != 'ignore' - attribute_value = self._attribute_value(element) or '' + attribute_value = self.attribute_value(element) or '' # If callback returns False, skip attachment loading if not callback(element, hints={'attrib': attribute_value}):