~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/ui/text.py

  • Committer: Vincent Ladeuil
  • Date: 2011-07-06 09:22:00 UTC
  • mfrom: (6008 +trunk)
  • mto: (6012.1.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 6013.
  • Revision ID: v.ladeuil+lp@free.fr-20110706092200-7iai2mwzc0sqdsvf
MergingĀ inĀ trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2010 Canonical Ltd
 
1
# Copyright (C) 2005-2011 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
18
18
"""Text UI, write output to the console.
19
19
"""
20
20
 
21
 
import codecs
22
 
import getpass
23
21
import os
24
22
import sys
25
23
import time
26
 
import warnings
27
24
 
28
25
from bzrlib.lazy_import import lazy_import
29
26
lazy_import(globals(), """
 
27
import codecs
 
28
import getpass
 
29
import warnings
 
30
 
30
31
from bzrlib import (
31
32
    debug,
32
33
    progress,
33
34
    osutils,
34
 
    symbol_versioning,
35
35
    trace,
36
36
    )
37
37
 
114
114
                password = password[:-1]
115
115
        return password
116
116
 
117
 
    def get_password(self, prompt='', **kwargs):
 
117
    def get_password(self, prompt=u'', **kwargs):
118
118
        """Prompt the user for a password.
119
119
 
120
120
        :param prompt: The prompt to present the user
198
198
        :param kwargs: Dictionary of arguments to insert into the prompt,
199
199
            to allow UIs to reformat the prompt.
200
200
        """
 
201
        if type(prompt) != unicode:
 
202
            raise ValueError("prompt %r not a unicode string" % prompt)
201
203
        if kwargs:
202
204
            # See <https://launchpad.net/bugs/365891>
203
205
            prompt = prompt % kwargs