[pytango] 38/98: Better exception management in tango object
Sandor Bodo-Merle
sbodomerle-guest at moszumanska.debian.org
Thu Sep 28 19:17:42 UTC 2017
This is an automated email from the git hooks/post-receive script.
sbodomerle-guest pushed a commit to tag v9.2.0
in repository pytango.
commit 0c9f8dba33f38c3df03a52c71ef2c820dc69957a
Author: Jose Tiago Coutinho Macara <tiago.coutinho at esrf.fr>
Date: Wed May 25 12:38:36 2016 +0200
Better exception management in tango object
---
src/boost/python/client.py | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/boost/python/client.py b/src/boost/python/client.py
index 50f3ab4..b47379c 100644
--- a/src/boost/python/client.py
+++ b/src/boost/python/client.py
@@ -18,6 +18,8 @@ This is an experimental module. Not part of the official API.
import weakref
import functools
+import six
+
import PyTango
from PyTango import DeviceProxy as Device
from PyTango import CmdArgType
@@ -189,7 +191,10 @@ class Object(object):
self.__dict__["_helper"] = helper
def __getattr__(self, name):
- r = self._helper.get(name)
+ try:
+ r = self._helper.get(name)
+ except KeyError as ke:
+ six.raise_from(AttributeError('Unknown {0}'.format(name)), ke)
if isinstance(r, PyTango.CommandInfo):
self.__dict__[name] = r.func
return r.func
@@ -198,8 +203,8 @@ class Object(object):
def __setattr__(self, name, value):
try:
return self._helper.set(name, value)
- except KeyError:
- object.__setattr__(self, name, value)
+ except KeyError as ke:
+ six.raise_from(AttributeError('Unknown {0}'.format(name)), ke)
def __str__(self):
return str(self._helper)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/pytango.git
More information about the debian-science-commits
mailing list