|
15 | 15 | delete a key if it exists |
16 | 16 | Note: deleteKey may not be recursive on all platforms. |
17 | 17 |
|
18 | | ->>> key=createKey( r"HKLM\SOFTWARE\Python\Test" ) |
| 18 | +>>> key=deleteKey( r"HKLM\SOFTWARE\Python\Test" ) |
19 | 19 |
|
20 | 20 | RemoteKey( machine, top_level_key ): |
21 | 21 | open a key on another machine. |
@@ -139,7 +139,7 @@ def _getName( item, nameFromNum ): |
139 | 139 | except (WindowsError, EnvironmentError): |
140 | 140 | raise IndexError, item |
141 | 141 |
|
142 | | - elif type( item )==StringType: |
| 142 | + elif type( item ) in [StringType, UnicodeType]: |
143 | 143 | keyname=item |
144 | 144 | else: |
145 | 145 | raise exceptions.TypeError, \ |
@@ -300,13 +300,17 @@ def setValue( self, valname, data, regtype=None ): |
300 | 300 | if regtype: |
301 | 301 | typeint=regtype.intval |
302 | 302 | else: |
303 | | - if type( data )==StringType: |
| 303 | + if type( data ) in [StringType, UnicodeType]: |
304 | 304 | typeint=_winreg.REG_SZ |
| 305 | + elif type( data )==ListType: |
| 306 | + # XXX - _winreg currently only supports lists |
| 307 | + # Also, probably should check each element is |
| 308 | + # string/unicode. |
| 309 | + typeint = _winreg.REG_MULTI_SZ |
305 | 310 | elif type( data )==IntType: |
306 | 311 | typeint=_winreg.REG_DWORD |
307 | 312 | elif type( data )==array.ArrayType: |
308 | 313 | typeint=_winreg.REG_BINARY |
309 | | - data=data.tostring() |
310 | 314 | _winreg.SetValueEx( self.handle, valname, 0, typeint, data ) |
311 | 315 |
|
312 | 316 | def flush(self ): |
|
0 commit comments