- Notifications
You must be signed in to change notification settings - Fork302
Deprecate the sanitizer and recommend Bleach#501
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -11,11 +11,18 @@ Breaking changes: | ||
| * Drop support for Python 3.3. (#358) | ||
| * Drop support for Python 3.4. (#421) | ||
| Deprecations: | ||
| * Deprecate the ``html5lib`` sanitizer (``html5lib.serialize(sanitize=True)`` and | ||
| ``html5lib.filters.sanitizer``). We recommend users migrate to `Bleach | ||
| <https://github.com/mozilla/bleach>`. Please let us know if Bleach doesn't suffice for your | ||
| use. (#443) | ||
| Other changes: | ||
| * Try to import from ``collections.abc`` to remove DeprecationWarning and ensure | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. 👍 | ||
| ``html5lib`` keeps working in future Python versions. (#403) | ||
| * Drop optional ``datrie`` dependency. (#442) | ||
| 1.0.1 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,15 @@ | ||
| """Deprecated from html5lib 1.1. | ||
| See `here <https://github.com/html5lib/html5lib-python/issues/443>`_ for | ||
| information about its deprecation; `Bleach <https://github.com/mozilla/bleach>`_ | ||
| is recommended as a replacement. Please let us know in the aforementioned issue | ||
| if Bleach is unsuitable for your needs. | ||
| """ | ||
| from __future__ import absolute_import, division, unicode_literals | ||
| import re | ||
| import warnings | ||
| from xml.sax.saxutils import escape, unescape | ||
| from six.moves import urllib_parse as urlparse | ||
| @@ -11,6 +20,14 @@ | ||
| __all__ = ["Filter"] | ||
| _deprecation_msg = ( | ||
| "html5lib's sanitizer is deprecated; see " + | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Seems like this string could be a global. | ||
| "https://github.com/html5lib/html5lib-python/issues/443 and please let " + | ||
| "us know if Bleach is unsuitable for your needs" | ||
| ) | ||
| warnings.warn(_deprecation_msg, DeprecationWarning) | ||
| allowed_elements = frozenset(( | ||
| (namespaces['html'], 'a'), | ||
| (namespaces['html'], 'abbr'), | ||
| @@ -750,6 +767,9 @@ def __init__(self, | ||
| """ | ||
| super(Filter, self).__init__(source) | ||
| warnings.warn(_deprecation_msg, DeprecationWarning) | ||
| self.allowed_elements = allowed_elements | ||
| self.allowed_attributes = allowed_attributes | ||
| self.allowed_css_properties = allowed_css_properties | ||