Rev 2489: (Vincent Ladeuil) Fix bug #110204 allowing proper password prompt encoding in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Wed May 23 10:22:22 BST 2007
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 2489
revision-id: pqm at pqm.ubuntu.com-20070523092220-d1hkaakjej39827x
parent: pqm at pqm.ubuntu.com-20070521152446-1v1dk0m7c705cdlx
parent: john at arbash-meinel.com-20070523085414-8o53d2txzpn4ni9y
committer: Canonical.com Patch Queue Manager<pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2007-05-23 10:22:20 +0100
message:
(Vincent Ladeuil) Fix bug #110204 allowing proper password prompt encoding
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/tests/__init__.py selftest.py-20050531073622-8d0e3c8845c97a64
bzrlib/ui/__init__.py ui.py-20050824083933-8cf663c763ba53a9
------------------------------------------------------------
revno: 2488.1.1
merged: john at arbash-meinel.com-20070523085414-8o53d2txzpn4ni9y
parent: pqm at pqm.ubuntu.com-20070521152446-1v1dk0m7c705cdlx
parent: v.ladeuil+lp at free.fr-20070426205243-gwo5c2xhd75tezxz
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: jam-integration
timestamp: Wed 2007-05-23 03:54:14 -0500
message:
(Vincent Ladeuil) Fix bug #110204 allowing proper password prompt encoding
------------------------------------------------------------
revno: 2461.1.2
merged: v.ladeuil+lp at free.fr-20070426205243-gwo5c2xhd75tezxz
parent: v.ladeuil+lp at free.fr-20070426081629-g0rsiqfszpxz2tto
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: 110204
timestamp: Thu 2007-04-26 22:52:43 +0200
message:
Take jam's remark into account.
* bzrlib/ui/__init__.py:
(CLIUIFactory.get_non_echoed_password): Better to use
osutils.get_terminal_encoding() !
------------------------------------------------------------
revno: 2461.1.1
merged: v.ladeuil+lp at free.fr-20070426081629-g0rsiqfszpxz2tto
parent: pqm at pqm.ubuntu.com-20070426070825-6xw10b1el98su02i
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: 110204
timestamp: Thu 2007-04-26 10:16:29 +0200
message:
Fix 110204 by letting TestUIFactory encode password prompt.
* bzrlib/ui/__init__.py:
(CLIUIFactory.get_non_echoed_password): Encode prompt with
sys.stdout.
(CLIUIFactory.get_password): Delegate prompt encoding to
get_non_echoed_password.
* bzrlib/tests/__init__.py:
(TestUIFactory.get_non_echoed_password): Encode prompt with
self.stdout.
=== modified file 'NEWS'
--- a/NEWS 2007-05-10 05:55:01 +0000
+++ b/NEWS 2007-05-23 08:54:14 +0000
@@ -8,6 +8,9 @@
that we can pass in the Transport that we already have.
(John Arbash Meinel, #75721)
+ * Let TestUIFactoy encode the password prompt with its own stdout.
+ (Vincent Ladeuil, #110204)
+
bzr 0.16 2007-05-07
=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py 2007-05-16 18:30:55 +0000
+++ b/bzrlib/tests/__init__.py 2007-05-23 08:54:14 +0000
@@ -721,7 +721,7 @@
def get_non_echoed_password(self, prompt):
"""Get password from stdin without trying to handle the echo mode"""
if prompt:
- self.stdout.write(prompt)
+ self.stdout.write(prompt.encode(self.stdout.encoding, 'replace'))
password = self.stdin.readline()
if not password:
raise EOFError
=== modified file 'bzrlib/ui/__init__.py'
--- a/bzrlib/ui/__init__.py 2007-03-23 01:41:37 +0000
+++ b/bzrlib/ui/__init__.py 2007-04-26 20:52:43 +0000
@@ -35,6 +35,7 @@
import getpass
from bzrlib import (
+ osutils,
progress,
trace,
)
@@ -111,7 +112,7 @@
current_format_name,
basedir)
-
+
class CLIUIFactory(UIFactory):
"""Common behaviour for command line UI factories."""
@@ -131,7 +132,8 @@
return False
def get_non_echoed_password(self, prompt):
- return getpass.getpass(prompt)
+ encoding = osutils.get_terminal_encoding()
+ return getpass.getpass(prompt.encode(encoding, 'replace'))
def get_password(self, prompt='', **kwargs):
"""Prompt the user for a password.
@@ -144,7 +146,7 @@
canceled the request.
"""
prompt += ': '
- prompt = (prompt % kwargs).encode(sys.stdout.encoding, 'replace')
+ prompt = (prompt % kwargs)
# There's currently no way to say 'i decline to enter a password'
# as opposed to 'my password is empty' -- does it matter?
return self.get_non_echoed_password(prompt)
More information about the bazaar-commits
mailing list