Mercurial > public > mercurial-scm > hg
comparison mercurial/util_win32.py @ 6881:d2375bbee6d4 1.0.2
Folding correction and missing import
author | Remy Roy <remyroy@remyroy.com> |
---|---|
date | Tue, 12 Aug 2008 10:05:00 -0400 |
parents | 892806b3fc0f |
children | 0d1c770c6be1 |
comparison
equal
deleted
inserted
replaced
6880:892806b3fc0f | 6881:d2375bbee6d4 |
---|---|
14 import win32api | 14 import win32api |
15 | 15 |
16 import errno, os, sys, pywintypes, win32con, win32file, win32process | 16 import errno, os, sys, pywintypes, win32con, win32file, win32process |
17 import cStringIO, winerror | 17 import cStringIO, winerror |
18 import osutil | 18 import osutil |
19 import util | |
19 from win32com.shell import shell,shellcon | 20 from win32com.shell import shell,shellcon |
20 | 21 |
21 class WinError: | 22 class WinError: |
22 winerror_map = { | 23 winerror_map = { |
23 winerror.ERROR_ACCESS_DENIED: errno.EACCES, | 24 winerror.ERROR_ACCESS_DENIED: errno.EACCES, |
205 scope = (HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE) | 206 scope = (HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE) |
206 elif not isinstance(scope, (list, tuple)): | 207 elif not isinstance(scope, (list, tuple)): |
207 scope = (scope,) | 208 scope = (scope,) |
208 for s in scope: | 209 for s in scope: |
209 try: | 210 try: |
210 val = QueryValueEx(OpenKey(scope, key), valname)[0] | 211 val = QueryValueEx(OpenKey(s, key), valname)[0] |
211 # never let a Unicode string escape into the wild | 212 # never let a Unicode string escape into the wild |
212 return util.tolocal(val.encode('UTF-8')) | 213 return util.tolocal(val.encode('UTF-8')) |
213 except EnvironmentError: | 214 except EnvironmentError: |
214 pass | 215 pass |
215 | 216 |