~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/osutils.py

  • Committer: Aaron Bentley
  • Date: 2010-05-10 11:34:20 UTC
  • mfrom: (5218 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5221.
  • Revision ID: aaron@aaronbentley.com-20100510113420-toh2d5yioobb5uq1
Merged bzr.dev into transform-commit-full.

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