[pytango] 274/483: fix problem with string properties

Sandor Bodo-Merle sbodomerle-guest at moszumanska.debian.org
Thu Sep 28 19:14:49 UTC 2017


This is an automated email from the git hooks/post-receive script.

sbodomerle-guest pushed a commit to annotated tag bliss_8.10
in repository pytango.

commit c135db1308938434813f6027bc9cc1b71bb579b9
Author: tiagocoutinho <tiagocoutinho at 4e9c00fd-8f2e-0410-aa12-93ce3db5e235>
Date:   Tue Aug 27 13:36:29 2013 +0000

    fix problem with string properties
    
    git-svn-id: http://svn.code.sf.net/p/tango-cs/code/bindings/PyTango/trunk@23441 4e9c00fd-8f2e-0410-aa12-93ce3db5e235
---
 src/boost/python/utils.py | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/src/boost/python/utils.py b/src/boost/python/utils.py
index 6676c57..c31b52e 100644
--- a/src/boost/python/utils.py
+++ b/src/boost/python/utils.py
@@ -588,18 +588,17 @@ def obj_2_str(obj, tg_type):
            :return: a string representation of the given object
            :rtype: :py:obj:`str`
     """
-    ret = ""
     if tg_type in _scalar_types:
         # scalar cases
-        if isinstance(obj, collections.Sequence):
+        if is_pure_str(obj):
+            return obj
+        elif is_non_str_seq(obj):
             if not len(obj):
-                return ret
+                return ""
             obj = obj[0]
-        ret = str(obj).rstrip()
-    else:
-        # sequence cases
-        ret = '\n'.join([ str(i) for i in obj ])
-    return ret
+        return str(obj)
+    # sequence cases
+    return '\n'.join([str(i) for i in obj])
 
 def __get_meth_func(klass, method_name):
     meth = getattr(klass, method_name)

-- 
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