|
| 1 | +"""Deprecated from html5lib 1.1. |
| 2 | +
|
| 3 | +See `here <https://github.com/html5lib/html5lib-python/issues/443>`_ for information about its |
| 4 | +deprecation; `Bleach <https://github.com/mozilla/bleach>`_ is recommended as a replacement. Please |
| 5 | +let us know in the aforementioned issue if Bleach is unsuitable for your needs. |
| 6 | +
|
| 7 | +""" |
1 | 8 | from __future__ import absolute_import, division, unicode_literals
|
2 | 9 |
|
3 | 10 | import re
|
|
12 | 19 | __all__ = ["Filter"]
|
13 | 20 |
|
14 | 21 |
|
15 |
| -warnings.warn( |
| 22 | +__deprecation_msg = ( |
16 | 23 | "html5lib's sanitizer is deprecated; see " +
|
17 | 24 | "https://github.com/html5lib/html5lib-python/issues/443 and please let " +
|
18 |
| - "us know if Bleach in unsuitable for your needs", |
19 |
| - DeprecationWarning |
| 25 | + "us know if Bleach is unsuitable for your needs" |
20 | 26 | )
|
21 | 27 |
|
| 28 | +warnings.warn(__deprecation_msg, DeprecationWarning) |
| 29 | + |
22 | 30 | allowed_elements = frozenset((
|
23 | 31 | (namespaces['html'], 'a'),
|
24 | 32 | (namespaces['html'], 'abbr'),
|
@@ -759,12 +767,7 @@ def __init__(self,
|
759 | 767 | """
|
760 | 768 | super(Filter, self).__init__(source)
|
761 | 769 |
|
762 |
| - warnings.warn( |
763 |
| - "html5lib's sanitizer is deprecated; see " + |
764 |
| - "https://github.com/html5lib/html5lib-python/issues/443 and please let " + |
765 |
| - "us know if Bleach in unsuitable for your needs", |
766 |
| - DeprecationWarning |
767 |
| - ) |
| 770 | + warnings.warn(__deprecation_msg, DeprecationWarning) |
768 | 771 |
|
769 | 772 | self.allowed_elements = allowed_elements
|
770 | 773 | self.allowed_attributes = allowed_attributes
|
|
0 commit comments