diff options
author | Cole Robinson <crobinso@redhat.com> | 2011-06-15 20:14:45 -0400 |
---|---|---|
committer | Cole Robinson <crobinso@redhat.com> | 2011-06-21 10:08:48 -0400 |
commit | 68ef6c759aa25ce0d78bb83734b27fac18f20e6c (patch) | |
tree | c6f6f54c9b73b2aa82fdc890704c14c99119ef27 /libvirt-override-virConnect.py | |
parent | 12d8d49559c2c4616357dd1d99cd7bcd39646033 (diff) | |
download | libvirt-python-v6-68ef6c759aa25ce0d78bb83734b27fac18f20e6c.tar.gz libvirt-python-v6-68ef6c759aa25ce0d78bb83734b27fac18f20e6c.tar.xz libvirt-python-v6-68ef6c759aa25ce0d78bb83734b27fac18f20e6c.zip |
python: Mark event callback wrappers as private
These functions aren't intended to be called directly by users, so mark
them as private.
While we're at it, remove unneeded exception handling, and break some
long lines.
Diffstat (limited to 'libvirt-override-virConnect.py')
-rw-r--r-- | libvirt-override-virConnect.py | 102 |
1 files changed, 44 insertions, 58 deletions
diff --git a/libvirt-override-virConnect.py b/libvirt-override-virConnect.py index 362be75..5be9659 100644 --- a/libvirt-override-virConnect.py +++ b/libvirt-override-virConnect.py @@ -33,7 +33,7 @@ ret = libvirtmod.virConnectDomainEventRegister(self._o, self) if ret == -1: raise libvirtError ('virConnectDomainEventRegister() failed', conn=self) - def dispatchDomainEventCallbacks(self, dom, event, detail): + def _dispatchDomainEventCallbacks(self, dom, event, detail): """Dispatches events to python user domain event callbacks """ try: @@ -43,7 +43,7 @@ except AttributeError: pass - def dispatchDomainEventLifecycleCallback(self, dom, event, detail, cbData): + def _dispatchDomainEventLifecycleCallback(self, dom, event, detail, cbData): """Dispatches events to python user domain lifecycle event callbacks """ cb = cbData["cb"] @@ -52,89 +52,75 @@ cb(self, virDomain(self, _obj=dom), event, detail, opaque) return 0 - def dispatchDomainEventGenericCallback(self, dom, cbData): + def _dispatchDomainEventGenericCallback(self, dom, cbData): """Dispatches events to python user domain generic event callbacks """ - try: - cb = cbData["cb"] - opaque = cbData["opaque"] + cb = cbData["cb"] + opaque = cbData["opaque"] - cb(self, virDomain(self, _obj=dom), opaque) - return 0 - except AttributeError: - pass + cb(self, virDomain(self, _obj=dom), opaque) + return 0 - def dispatchDomainEventRTCChangeCallback(self, dom, offset, cbData): + def _dispatchDomainEventRTCChangeCallback(self, dom, offset, cbData): """Dispatches events to python user domain RTC change event callbacks """ - try: - cb = cbData["cb"] - opaque = cbData["opaque"] + cb = cbData["cb"] + opaque = cbData["opaque"] - cb(self, virDomain(self, _obj=dom), offset ,opaque) - return 0 - except AttributeError: - pass + cb(self, virDomain(self, _obj=dom), offset ,opaque) + return 0 - def dispatchDomainEventWatchdogCallback(self, dom, action, cbData): + def _dispatchDomainEventWatchdogCallback(self, dom, action, cbData): """Dispatches events to python user domain watchdog event callbacks """ - try: - cb = cbData["cb"] - opaque = cbData["opaque"] + cb = cbData["cb"] + opaque = cbData["opaque"] - cb(self, virDomain(self, _obj=dom), action, opaque) - return 0 - except AttributeError: - pass + cb(self, virDomain(self, _obj=dom), action, opaque) + return 0 - def dispatchDomainEventIOErrorCallback(self, dom, srcPath, devAlias, action, cbData): + def _dispatchDomainEventIOErrorCallback(self, dom, srcPath, devAlias, + action, cbData): """Dispatches events to python user domain IO error event callbacks """ - try: - cb = cbData["cb"] - opaque = cbData["opaque"] + cb = cbData["cb"] + opaque = cbData["opaque"] - cb(self, virDomain(self, _obj=dom), srcPath, devAlias, action, opaque) - return 0 - except AttributeError: - pass + cb(self, virDomain(self, _obj=dom), srcPath, devAlias, action, opaque) + return 0 - def dispatchDomainEventIOErrorReasonCallback(self, dom, srcPath, devAlias, action, reason, cbData): + def _dispatchDomainEventIOErrorReasonCallback(self, dom, srcPath, + devAlias, action, reason, + cbData): """Dispatches events to python user domain IO error event callbacks """ - try: - cb = cbData["cb"] - opaque = cbData["opaque"] + cb = cbData["cb"] + opaque = cbData["opaque"] - cb(self, virDomain(self, _obj=dom), srcPath, devAlias, action, reason, opaque) - return 0 - except AttributeError: - pass + cb(self, virDomain(self, _obj=dom), srcPath, devAlias, action, + reason, opaque) + return 0 - def dispatchDomainEventGraphicsCallback(self, dom, phase, localAddr, remoteAddr, authScheme, subject, cbData): + def _dispatchDomainEventGraphicsCallback(self, dom, phase, localAddr, + remoteAddr, authScheme, subject, + cbData): """Dispatches events to python user domain graphics event callbacks """ - try: - cb = cbData["cb"] - opaque = cbData["opaque"] + cb = cbData["cb"] + opaque = cbData["opaque"] - cb(self, virDomain(self, _obj=dom), phase, localAddr, remoteAddr, authScheme, subject, opaque) - return 0 - except AttributeError: - pass + cb(self, virDomain(self, _obj=dom), phase, localAddr, remoteAddr, + authScheme, subject, opaque) + return 0 - def dispatchDomainEventBlockPullCallback(self, dom, path, status, cbData): + def _dispatchDomainEventBlockPullCallback(self, dom, path, status, cbData): """Dispatches events to python user domain blockPull event callbacks """ - try: - cb = cbData["cb"] - opaque = cbData["opaque"] + cb = cbData["cb"] + opaque = cbData["opaque"] - cb(self, virDomain(self, _obj=dom), path, status, opaque) - return 0 - except AttributeError: - pass + cb(self, virDomain(self, _obj=dom), path, status, opaque) + return 0 def domainEventDeregisterAny(self, callbackID): """Removes a Domain Event Callback. De-registering for a |