Exposes a single Windows Registry key as a dictionary-like object. @see: L{Registry} @type path: str @ivar path: Registry key path. @type handle: L{win32.RegistryKeyHandle} @ivar handle: Registry key handle.
| 86 | |
| 87 | |
| 88 | class RegistryKey(_RegistryContainer): |
| 89 | """ |
| 90 | Exposes a single Windows Registry key as a dictionary-like object. |
| 91 | |
| 92 | @see: L{Registry} |
| 93 | |
| 94 | @type path: str |
| 95 | @ivar path: Registry key path. |
| 96 | |
| 97 | @type handle: L{win32.RegistryKeyHandle} |
| 98 | @ivar handle: Registry key handle. |
| 99 | """ |
| 100 | |
| 101 | def __init__(self, path, handle): |
| 102 | """ |
| 103 | @type path: str |
| 104 | @param path: Registry key path. |
| 105 | |
| 106 | @type handle: L{win32.RegistryKeyHandle} |
| 107 | @param handle: Registry key handle. |
| 108 | """ |
| 109 | super(RegistryKey, self).__init__() |
| 110 | if path.endswith("\\"): |
| 111 | path = path[:-1] |
| 112 | self._path = path |
| 113 | self._handle = handle |
| 114 | |
| 115 | @property |
| 116 | def path(self): |
| 117 | return self._path |
| 118 | |
| 119 | @property |
| 120 | def handle(self): |
| 121 | # if not self._handle: |
| 122 | # msg = "This Registry key handle has already been closed." |
| 123 | # raise RuntimeError(msg) |
| 124 | return self._handle |
| 125 | |
| 126 | # def close(self): |
| 127 | # """ |
| 128 | # Close the Registry key handle, freeing its resources. It cannot be |
| 129 | # used again after calling this method. |
| 130 | # |
| 131 | # @note: This method will be called automatically by the garbage |
| 132 | # collector, and upon exiting a "with" block. |
| 133 | # |
| 134 | # @raise RuntimeError: This Registry key handle has already been closed. |
| 135 | # """ |
| 136 | # self.handle.close() |
| 137 | # |
| 138 | # def __enter__(self): |
| 139 | # """ |
| 140 | # Compatibility with the "C{with}" Python statement. |
| 141 | # """ |
| 142 | # return self |
| 143 | # |
| 144 | # def __exit__(self, type, value, traceback): |
| 145 | # """ |
no outgoing calls
no test coverage detected