SaStringT class is introduced in previous commit support python3.
Default SaStringT cannot compare with other type.
This commit is to allow compare with str class if without casting
---
python/pyosaf/saAis.py | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/python/pyosaf/saAis.py b/python/pyosaf/saAis.py
index 912523e69..d890c6a27 100644
--- a/python/pyosaf/saAis.py
+++ b/python/pyosaf/saAis.py
@@ -53,6 +53,16 @@ if PY3:
return self.value.decode('utf-8')
else:
return self.__repr__()
+
+ def __eq__(self, other):
+ if isinstance(other, str):
+ return str(self).__eq__(other)
+ return super().__eq__(other)
+
+ def __ne__(self, other):
+ if isinstance(other, str):
+ return str(self).__ne__(other)
+ return super().__ne__(other)
else:
SaStringT = ctypes.c_char_p
--
2.43.0
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel