~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/osutils.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-05-05 17:31:16 UTC
  • mfrom: (5187.2.10 549310-mandatory-whoami)
  • Revision ID: pqm@pqm.ubuntu.com-20100505173116-peb5afaw8y7b9i2o
bzr does not guess whoami anymore. (parthm, #549310)

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
lazy_import(globals(), """
27
27
from datetime import datetime
28
28
import errno
 
29
import getpass
29
30
from ntpath import (abspath as _nt_abspath,
30
31
                    join as _nt_join,
31
32
                    normpath as _nt_normpath,
2302
2303
        return os.fdopen(os.open(filename, flags), mode, bufsize)
2303
2304
else:
2304
2305
    open_file = open
 
2306
 
 
2307
 
 
2308
def getuser_unicode():
 
2309
    """Return the username as unicode.
 
2310
    """
 
2311
    try:
 
2312
        user_encoding = get_user_encoding()
 
2313
        username = getpass.getuser().decode(user_encoding)
 
2314
    except UnicodeDecodeError:
 
2315
        raise errors.BzrError("Can't decode username as %s." % \
 
2316
                user_encoding)
 
2317
    return username