Repository: pypi/warehouse

Issue:
Update bleach to 2.0.0

There's a new version of [bleach](https://pypi.python.org/pypi/bleach) available.
You are currently using **1.5.0**. I have updated it to **2.0.0**



These links might come in handy:  <a href="http://pypi.python.org/pypi/bleach">PyPI</a> | <a href="https://pyup.io/changelogs/bleach/">Changelog</a> | <a href="http://github.com/mozilla/bleach">Repo</a> | <a href="http://pythonhosted.org/bleach/">Docs</a> 



### Changelog
> 
>### 2.0

>-----------------------------

>**Backwards incompatible changes**

>* Removed support for Python 2.6. 206

>* Removed support for Python 3.2. 224

>* Bleach no longer supports html5lib &lt; 0.99999999 (8 9s).

>  This version is a rewrite to use the new sanitizing API since the old
>  one was dropped in html5lib 0.99999999 (8 9s).

>* ``bleach.clean`` and friends were rewritten

>  ``clean`` was reimplemented as an html5lib filter and happens at a different
>  step in the HTML parsing -&gt; traversing -&gt; serializing process. Because of
>  that, there are some differences in clean&#39;s output as compared with previous
>  versions.

>  Amongst other things, this version will add end tags even if the tag in
>  question is to be escaped.

>* ``bleach.clean`` and friends attribute callables now take three arguments:
>  tag, attribute name and attribute value. Previously they only took attribute
>  name and attribute value.

>  All attribute callables will need to be updated.

>* ``bleach.linkify`` was rewritten

>  ``linkify`` was reimplemented as an html5lib Filter. As such, it no longer
>  accepts a ``tokenizer`` argument.

>  The callback functions for adjusting link attributes now takes a namespaced
>  attribute.

>  Previously you&#39;d do something like this::

>      def check_protocol(attrs, is_new):
>          if not attrs.get(&#39;href&#39;, &#39;&#39;).startswith(&#39;http:&#39;, &#39;https:&#39;)):
>              return None
>          return attrs

>  Now it&#39;s more like this::

>      def check_protocol(attrs, is_new):
>          if not attrs.get((None, u&#39;href&#39;), u&#39;&#39;).startswith((&#39;http:&#39;, &#39;https:&#39;)):
>                          ^^^^^^^^^^^^^^^
>              return None
>          return attrs

>  Further, you need to make sure you&#39;re always using unicode values. If you
>  don&#39;t then html5lib will raise an assertion error that the value is not
>  unicode.

>  All linkify filters will need to be updated.

>* ``bleach.linkify`` and friends had a ``skip_pre`` argument--that&#39;s been
>  replaced with a more general ``skip_tags`` argument.

>  Before, you might do::

>      bleach.linkify(some_text, skip_pre=True)

>  The equivalent with Bleach 2.0 is::

>      bleach.linkify(some_text, skip_tags=[&#39;pre&#39;])

>  You can skip other tags, too, like ``style`` or ``script`` or other places
>  where you don&#39;t want linkification happening.

>  All uses of linkify that use ``skip_pre`` will need to be updated.


>**Changes**

>* Supports Python 3.6.

>* Supports html5lib &gt;= 0.99999999 (8 9s).

>* There&#39;s a ``bleach.sanitizer.Cleaner`` class that you can instantiate with your
>  favorite clean settings for easy reuse.

>* There&#39;s a ``bleach.linkifier.Linker`` class that you can instantiate with your
>  favorite linkify settings for easy reuse.

>* There&#39;s a ``bleach.linkifier.LinkifyFilter`` which is an htm5lib filter that
>  you can pass as a filter to ``bleach.sanitizer.Cleaner`` allowing you to clean
>  and linkify in one pass.

>* ``bleach.clean`` and friends can now take a callable as an attributes arg value.

>* Tons of bug fixes.

>* Cleaned up tests.

>* Documentation fixes.








*Got merge conflicts? Close this PR and delete the branch. I'll create a new PR for you.*

Happy merging! 🤖



Discussion:

Resolving patch:
diff --git a/warehouse/filters.py b/warehouse/filters.py
--- a/warehouse/filters.py
+++ b/warehouse/filters.py
@@ -94,7 +94,7 @@ def readme(ctx, value, *, format):
             element.setAttribute("src", _camo_url(camo_url, camo_key, src))
 
     tree_walker = html5lib.treewalkers.getTreeWalker("dom")
-    html_serializer = html5lib.serializer.htmlserializer.HTMLSerializer()
+    html_serializer = html5lib.serializer.HTMLSerializer()
     rendered = "".join(html_serializer.serialize(tree_walker(dom)))
 
     return jinja2.Markup(rendered)


Test patch:
diff --git a/tests/unit/test_filters.py b/tests/unit/test_filters.py
--- a/tests/unit/test_filters.py
+++ b/tests/unit/test_filters.py
@@ -100,7 +100,7 @@ def test_renders_camo(self, monkeypatch):
         result = filters.readme(ctx, "raw thing", format="rst")
 
         assert result == jinja2.Markup(
-            "<img src=https://camo.example.net/image.jpg>"
+            '<img src="https://camo.example.net/image.jpg">'
         )
         assert gen_camo_url.calls == [
             pretend.call(