Rev 5925: Fix some more prompts to be unicode. in http://bazaar.launchpad.net/~vila/bzr/integration/

Vincent Ladeuil v.ladeuil+lp at free.fr
Fri May 27 07:39:42 UTC 2011


At http://bazaar.launchpad.net/~vila/bzr/integration/

------------------------------------------------------------
revno: 5925
revision-id: v.ladeuil+lp at free.fr-20110527073941-9rt9xfex6vg02al5
parent: v.ladeuil+lp at free.fr-20110527051648-zmmcr3rzmskbvign
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: trunk
timestamp: Fri 2011-05-27 09:39:41 +0200
message:
  Fix some more prompts to be unicode.
-------------- next part --------------
=== modified file 'bzrlib/transport/http/__init__.py'
--- a/bzrlib/transport/http/__init__.py	2011-01-26 19:34:58 +0000
+++ b/bzrlib/transport/http/__init__.py	2011-05-27 07:39:41 +0000
@@ -74,7 +74,7 @@
             password = urllib.unquote(password)
         else:
             password = ui.ui_factory.get_password(
-                prompt='HTTP %(user)s@%(host)s password',
+                prompt=u'HTTP %(user)s@%(host)s password',
                 user=username, host=host)
         password_manager.add_password(None, host, username, password)
     url = urlparse.urlunsplit((scheme, netloc, path, query, fragment))

=== modified file 'bzrlib/transport/http/_pycurl.py'
--- a/bzrlib/transport/http/_pycurl.py	2010-11-06 10:55:58 +0000
+++ b/bzrlib/transport/http/_pycurl.py	2011-05-27 07:39:41 +0000
@@ -301,7 +301,9 @@
         The URL and code are automatically included as appropriate.
 
         :param info: Extra information to include in the message.
-        :param body: File-like object from which the body of the page can be read.
+
+        :param body: File-like object from which the body of the page can be
+            read.
         """
         code = curl.getinfo(pycurl.HTTP_CODE)
         url = curl.getinfo(pycurl.EFFECTIVE_URL)
@@ -321,7 +323,7 @@
             else:
                 msg = ': ' + info
             raise errors.InvalidHttpResponse(
-                url, 'Unable to handle http code %d%s: %s' 
+                url, 'Unable to handle http code %d%s: %s'
                 % (code, msg, plaintext_body))
 
     def _debug_cb(self, kind, text):

=== modified file 'bzrlib/transport/http/_urllib2_wrappers.py'
--- a/bzrlib/transport/http/_urllib2_wrappers.py	2011-05-12 07:53:55 +0000
+++ b/bzrlib/transport/http/_urllib2_wrappers.py	2011-05-27 07:39:41 +0000
@@ -1260,11 +1260,11 @@
         user. The daughter classes should implements a public
         build_password_prompt using this method.
         """
-        prompt = '%s' % auth['protocol'].upper() + ' %(user)s@%(host)s'
+        prompt = u'%s' % auth['protocol'].upper() + u' %(user)s@%(host)s'
         realm = auth['realm']
         if realm is not None:
-            prompt += ", Realm: '%s'" % realm
-        prompt += ' password'
+            prompt += u", Realm: '%s'" % realm.decode('utf8')
+        prompt += u' password'
         return prompt
 
     def _build_username_prompt(self, auth):
@@ -1278,11 +1278,11 @@
         user. The daughter classes should implements a public
         build_username_prompt using this method.
         """
-        prompt = '%s' % auth['protocol'].upper() + ' %(host)s'
+        prompt = u'%s' % auth['protocol'].upper() + u' %(host)s'
         realm = auth['realm']
         if realm is not None:
-            prompt += ", Realm: '%s'" % realm
-        prompt += ' username'
+            prompt += u", Realm: '%s'" % realm.decode('utf8')
+        prompt += u' username'
         return prompt
 
     def http_request(self, request):
@@ -1552,12 +1552,12 @@
 
     def build_password_prompt(self, auth):
         prompt = self._build_password_prompt(auth)
-        prompt = 'Proxy ' + prompt
+        prompt = u'Proxy ' + prompt
         return prompt
 
     def build_username_prompt(self, auth):
         prompt = self._build_username_prompt(auth)
-        prompt = 'Proxy ' + prompt
+        prompt = u'Proxy ' + prompt
         return prompt
 
     def http_error_407(self, req, fp, code, msg, headers):



More information about the bazaar-commits mailing list