[pytango] 18/21: Add exception trying to create writtable pipe or trying to write to one
Sandor Bodo-Merle
sbodomerle-guest at moszumanska.debian.org
Thu Sep 28 19:16:35 UTC 2017
This is an automated email from the git hooks/post-receive script.
sbodomerle-guest pushed a commit to annotated tag v9.2.0a
in repository pytango.
commit 9994dc2e15abb960c38918dd7d407e355e6880e1
Author: Jose Tiago Coutinho Macara <tiago.coutinho at esrf.fr>
Date: Fri Feb 26 09:16:04 2016 +0100
Add exception trying to create writtable pipe or trying to write to one
---
src/boost/python/device_proxy.py | 31 +++++++++++++++++++++++--------
src/boost/python/server.py | 9 ++++-----
2 files changed, 27 insertions(+), 13 deletions(-)
diff --git a/src/boost/python/device_proxy.py b/src/boost/python/device_proxy.py
index 95ff374..df768b9 100644
--- a/src/boost/python/device_proxy.py
+++ b/src/boost/python/device_proxy.py
@@ -242,16 +242,31 @@ def __DeviceProxy__getattr(self, name):
raise AttributeError(name)
def __DeviceProxy__setattr(self, name, value):
+ name_l = name.lower()
+
+ if name_l in self.__attr_cache:
+ return self.write_attribute(name, value)
+
+ if name_l in self.__pipe_cache:
+ return self.write_pipe(name, value)
+
try:
- if not hasattr(self, '__attr_cache') or name.lower() not in self.__attr_cache:
- self.__refresh_attr_cache()
+ self.__refresh_attr_cache()
except:
- return super(DeviceProxy, self).__setattr__(name, value)
+ pass
- if name.lower() in self.__attr_cache:
- self.write_attribute(name, value)
- else:
- return super(DeviceProxy, self).__setattr__(name, value)
+ if name_l in self.__attr_cache:
+ return self.write_attribute(name, value)
+
+ try:
+ self.__refresh_pipe_cache()
+ except:
+ pass
+
+ if name_l in self.__pipe_cache:
+ return self.write_pipe(name, value)
+
+ return super(DeviceProxy, self).__setattr__(name, value)
def __DeviceProxy__getAttributeNames(self):
@@ -1169,7 +1184,7 @@ def __DeviceProxy__read_pipe(self, pipe_name, extract_as=ExtractAs.Numpy):
return r.extract(extract_as)
def __DeviceProxy__write_pipe(*args, **kwargs):
- raise NotImplementedError
+ raise NotImplementedError('writtable pipes not implemented in 9.2.0a')
def __DeviceProxy__read_attributes(self, *args, **kwargs):
return self._read_attributes(*args, **kwargs)
diff --git a/src/boost/python/server.py b/src/boost/python/server.py
index cf60482..5b39ff5 100644
--- a/src/boost/python/server.py
+++ b/src/boost/python/server.py
@@ -977,6 +977,8 @@ class pipe(PipeData):
super(pipe, self).__init__(name, class_name)
self.build_from_dict(kwargs)
+ if self.pipe_write == PipeWriteType.PIPE_READ_WRITE:
+ raise NotImplementedError('writtable pipes not implemented in 9.2.0a')
def get_pipe(self, obj):
dclass = obj.get_device_class()
@@ -998,12 +1000,9 @@ class pipe(PipeData):
To be used as a decorator. Will define the decorated method
as a write pipe method to be called when client writes to the pipe
"""
+ raise NotImplementedError('writtable pipes not implemented in 9.2.0a')
self.fset = fset
- if self.attr_write == AttrWriteType.READ:
- if getattr(self, 'fget', None):
- self.attr_write = AttrWriteType.READ_WRITE
- else:
- self.attr_write = AttrWriteType.WRITE
+ self.pipe_write = PipeWriteType.PIPE_READ_WRITE
return self
def write(self, fset):
--
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