From 5acc982b445a5fe4e7114cc4cb5df6939f8332f7 Mon Sep 17 00:00:00 2001 From: Daniel Schadt Date: Thu, 3 Dec 2015 22:47:10 +0100 Subject: [PATCH 1/2] Clean up mhtml doc and use email.message.Message MIMEMultipart is not needed for the attachements, a simple Message is enough. Also fix the README markup and the _start_download docstring. --- README.asciidoc | 1 + qutebrowser/browser/mhtml.py | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/README.asciidoc b/README.asciidoc index 8e5adc187..b8aa08aad 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -103,6 +103,7 @@ The following software and libraries are required to run qutebrowser: * http://pyyaml.org/wiki/PyYAML[PyYAML] The following libraries are optional and provide a better user experience: + * http://cthedot.de/cssutils/[cssutils] To generate the documentation for the `:help` command, when using the git diff --git a/qutebrowser/browser/mhtml.py b/qutebrowser/browser/mhtml.py index e5845a07d..99fafc6d7 100644 --- a/qutebrowser/browser/mhtml.py +++ b/qutebrowser/browser/mhtml.py @@ -30,6 +30,7 @@ import email.policy import email.generator import email.encoders import email.mime.multipart +import email.message from PyQt5.QtCore import QUrl @@ -205,11 +206,10 @@ class MHTMLWriter: return self._create_file(root_file) def _create_file(self, f): - """Return the single given file as MIMEMultipart.""" - msg = email.mime.multipart.MIMEMultipart() + """Return the single given file as email.message.Message.""" + msg = email.message.Message() + msg['MIME-Version'] = '1.0' msg['Content-Location'] = f.content_location - # Get rid of the default type multipart/mixed - del msg['Content-Type'] if f.content_type: msg.set_type(f.content_type) msg.set_payload(f.content) @@ -475,7 +475,7 @@ def _start_download(dest, web_view): Args: dest: The filename where the resulting file should be saved. - win_id, tab_id: Specify the tab whose page should be loaded. + web_view: Specify the webview whose page should be loaded. """ loader = _Downloader(web_view, dest) loader.run() From 2a030107b99d89f5fac9918cc7c69150fa8ada3b Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 4 Dec 2015 07:16:34 +0100 Subject: [PATCH 2/2] tox: Upgrade CherryPy to 3.8.0. Pass ``exc_info`` to logger as keyword rather than formatting the error and injecting into the message. --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 9d1075239..01c0c8793 100644 --- a/tox.ini +++ b/tox.ini @@ -42,7 +42,7 @@ deps = Werkzeug==0.11.2 wheel==0.26.0 xvfbwrapper==0.2.5 - cherrypy==3.8.0 + cherrypy==3.8.1 commands = {envpython} scripts/link_pyqt.py --tox {envdir} {envpython} -m py.test --strict -rfEsw --faulthandler-timeout=70 --cov --cov-report xml --cov-report=html --cov-report= {posargs:tests}