~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/osutils.py

  • Committer: John Arbash Meinel
  • Date: 2010-05-11 14:13:31 UTC
  • mto: (5218.2.2 bytes_to_entry_c)
  • mto: This revision was merged to the branch mainline in revision 5225.
  • Revision ID: john@arbash-meinel.com-20100511141331-rizo2ez6bze3ao66
Some small tweaks to the chk_map code.

Find out that we actually weren't using the global definition because we
were assigning inside the if block. So factor that out into a helper.

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