# Bazaar revision bundle v0.9 # # 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. # # committer: Vincent Ladeuil # date: Thu 2007-04-26 10:16:29.312000036 +0200 === modified file NEWS --- NEWS +++ NEWS @@ -219,6 +219,9 @@ * Handle moving a directory when children have been added, removed, and renamed. (John Arbash Meinel, #105479) + * Let TestUIFactoy encode the password prompt with its own stdout. + (Vincent Ladeuil, #110204) + TESTING: * Added ``bzrlib.strace.strace`` which will strace a single callable and === modified file bzrlib/tests/__init__.py --- bzrlib/tests/__init__.py +++ bzrlib/tests/__init__.py @@ -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 --- bzrlib/ui/__init__.py +++ bzrlib/ui/__init__.py @@ -111,7 +111,7 @@ current_format_name, basedir) - + class CLIUIFactory(UIFactory): """Common behaviour for command line UI factories.""" @@ -131,7 +131,7 @@ return False def get_non_echoed_password(self, prompt): - return getpass.getpass(prompt) + return getpass.getpass(prompt.encode(sys.stdout.encoding, 'replace')) def get_password(self, prompt='', **kwargs): """Prompt the user for a password. @@ -144,7 +144,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) === modified directory // last-changed:v.ladeuil+lp@free.fr-20070426081629-g0r ... siqfszpxz2tto # revision id: v.ladeuil+lp@free.fr-20070426081629-g0rsiqfszpxz2tto # sha1: bbdd7249c7c966bb77a2c88c8926acd5a4b65b4c # inventory sha1: aa1d3ef2b1bffab967a77327e9ff15594379a664 # parent ids: # pqm@pqm.ubuntu.com-20070426070825-6xw10b1el98su02i # base id: pqm@pqm.ubuntu.com-20070426070825-6xw10b1el98su02i # properties: # bugs: # branch-nick: 110204