diff options
author | Mark Hammond <mhammond@skippinet.com.au> | 2000-07-28 03:42:40 (GMT) |
---|---|---|
committer | Mark Hammond <mhammond@skippinet.com.au> | 2000-07-28 03:42:40 (GMT) |
commit | abfeff7f44fcc9451d7f4588bda53adebd2d4ea4 (patch) | |
tree | 148e427fa97d7e8168ae28da2b722fd17de64a6f /Lib/plat-win | |
parent | c64c8ea71c80ef028dc9d1236f416a19913e0665 (diff) | |
download | cpython-abfeff7f44fcc9451d7f4588bda53adebd2d4ea4.zip cpython-abfeff7f44fcc9451d7f4588bda53adebd2d4ea4.tar.gz cpython-abfeff7f44fcc9451d7f4588bda53adebd2d4ea4.tar.bz2 |
Fix a type in the docstrings, and make the module Unicode aware.
Diffstat (limited to 'Lib/plat-win')
-rw-r--r-- | Lib/plat-win/winreg.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/Lib/plat-win/winreg.py b/Lib/plat-win/winreg.py index 6fec5c7..8da70e9 100644 --- a/Lib/plat-win/winreg.py +++ b/Lib/plat-win/winreg.py @@ -15,7 +15,7 @@ deleteKey( keyname ) delete a key if it exists Note: deleteKey may not be recursive on all platforms. ->>> key=createKey( r"HKLM\SOFTWARE\Python\Test" ) +>>> key=deleteKey( r"HKLM\SOFTWARE\Python\Test" ) RemoteKey( machine, top_level_key ): open a key on another machine. @@ -139,7 +139,7 @@ def _getName( item, nameFromNum ): except (WindowsError, EnvironmentError): raise IndexError, item - elif type( item )==StringType: + elif type( item ) in [StringType, UnicodeType]: keyname=item else: raise exceptions.TypeError, \ @@ -300,13 +300,17 @@ class RegKey: if regtype: typeint=regtype.intval else: - if type( data )==StringType: + if type( data ) in [StringType, UnicodeType]: typeint=_winreg.REG_SZ + elif type( data )==ListType: + # XXX - _winreg currently only supports lists + # Also, probably should check each element is + # string/unicode. + typeint = _winreg.REG_MULTI_SZ elif type( data )==IntType: typeint=_winreg.REG_DWORD elif type( data )==array.ArrayType: typeint=_winreg.REG_BINARY - data=data.tostring() _winreg.SetValueEx( self.handle, valname, 0, typeint, data ) def flush(self ): |