~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/ui/__init__.py

  • Committer: Jonathan Lange
  • Date: 2007-04-23 01:30:35 UTC
  • mto: This revision was merged to the branch mainline in revision 2446.
  • Revision ID: jml@canonical.com-20070423013035-zuqiamuro8h1hba9
Can also set the bug config options in branch.conf

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
import getpass
36
36
 
37
37
from bzrlib import (
38
 
    osutils,
39
38
    progress,
40
39
    trace,
41
40
    )
112
111
            current_format_name,
113
112
            basedir)
114
113
 
115
 
 
 
114
            
116
115
class CLIUIFactory(UIFactory):
117
116
    """Common behaviour for command line UI factories."""
118
117
 
132
131
                return False
133
132
 
134
133
    def get_non_echoed_password(self, prompt):
135
 
        encoding = osutils.get_terminal_encoding()
136
 
        return getpass.getpass(prompt.encode(encoding, 'replace'))
 
134
        return getpass.getpass(prompt)
137
135
 
138
136
    def get_password(self, prompt='', **kwargs):
139
137
        """Prompt the user for a password.
146
144
                 canceled the request.
147
145
        """
148
146
        prompt += ': '
149
 
        prompt = (prompt % kwargs)
 
147
        prompt = (prompt % kwargs).encode(sys.stdout.encoding, 'replace')
150
148
        # There's currently no way to say 'i decline to enter a password'
151
149
        # as opposed to 'my password is empty' -- does it matter?
152
150
        return self.get_non_echoed_password(prompt)