← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:py3-librarianserver-static-responses into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:py3-librarianserver-static-responses into launchpad:master.

Commit message:
Static librarianserver responses are bytes

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

In Python 3, we need to be careful to pass them as such.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-librarianserver-static-responses into launchpad:master.
diff --git a/lib/lp/services/librarianserver/web.py b/lib/lp/services/librarianserver/web.py
index 994327f..bb0612a 100644
--- a/lib/lp/services/librarianserver/web.py
+++ b/lib/lp/services/librarianserver/web.py
@@ -38,7 +38,7 @@ from lp.services.librarian.client import url_path_quote
 from lp.services.librarian.utils import guess_librarian_encoding
 
 
-defaultResource = static.Data("""
+defaultResource = static.Data(b"""
         <html>
         <body>
         <h1>Launchpad Librarian</h1>
@@ -316,7 +316,7 @@ class DigestSearchResource(resource.Resource):
         try:
             digest = request.args['digest'][0]
         except LookupError:
-            return static.Data('Bad search', 'text/plain').render(request)
+            return static.Data(b'Bad search', 'text/plain').render(request)
 
         deferred = deferToThread(self._matchingAliases, digest)
         deferred.addCallback(self._cb_matchingAliases, request)
@@ -340,7 +340,7 @@ class DigestSearchResource(resource.Resource):
 
 
 # Ask robots not to index or archive anything in the librarian.
-robotsTxt = static.Data("""
+robotsTxt = static.Data(b"""
 User-agent: *
 Disallow: /
 """, type='text/plain')