def __init__(self, moniker, access=DEFAULT_ACCESS): core._WinSysObject.__init__(self) utils._set(self, "hKey", None) utils._set(self, "moniker", unicode(moniker)) utils._set(self, "id", _parse_moniker(self.moniker.lower(), accept_value=False)) utils._set(self, "access", self._access(access)) utils._set(self, "name", moniker.split(sep)[-1] if moniker else "")
def pyobject(self): """Lazily return an internal registry key handle according to the instance's access requirements. :raises: :exc:`x_not_found` if the registry path the key refers to does not exist """ if self.hKey is None: hKey, moniker, _ = self._from_string(self.moniker, access=self.access, accept_value=False) utils._set(self, "hKey", hKey) if self.hKey is None: raise exc.x_not_found(errctx="Registry.pyobject", errmsg="Registry path %s not found" % moniker) return self.hKey