← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:py3-stop-encoding-mimetype into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:py3-stop-encoding-mimetype into launchpad:master.

Commit message:
Stop encoding mimetype in guess_librarian_encoding

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/398786

This is only used by lp.services.librarianserver.web, which already coerces it to bytes when sending it as the value of a Content-Encoding header.  Having a consistent return type is helpful for tests.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-stop-encoding-mimetype into launchpad:master.
diff --git a/lib/lp/services/librarian/utils.py b/lib/lp/services/librarian/utils.py
index ca8411a..3d627e1 100644
--- a/lib/lp/services/librarian/utils.py
+++ b/lib/lp/services/librarian/utils.py
@@ -72,6 +72,5 @@ def guess_librarian_encoding(filename, mimetype):
         mimetype = 'text/plain'
     else:
         encoding = None
-        mimetype = mimetype.encode('ascii')
 
     return encoding, mimetype