Hi, Please help review!
Thanks, Quyen -----Original Message----- From: Quyen Dao [mailto:quyen....@dektech.com.au] Sent: Wednesday, May 25, 2016 11:45 AM To: hans.nordeb...@ericsson.com; srikanth.revan...@oracle.com Cc: opensaf-devel@lists.sourceforge.net Subject: [devel] [PATCH 1 of 1] pyosaf: Add __str__ method into non extended SaNameT class [#1737] python/pyosaf/saAis.py | 5 +++++ python/pyosaf/saImm.py | 2 +- python/pyosaf/saNtf.py | 3 ++- 3 files changed, 8 insertions(+), 2 deletions(-) with this change, user can call str(sa_name_t_obj) to convert SaNameT to str without caring it's extended or non extended. unmarshalSaImmValue and unmarshalSaNtfValue functions are also changed to support both extended and non extended SaNameT diff --git a/python/pyosaf/saAis.py b/python/pyosaf/saAis.py --- a/python/pyosaf/saAis.py +++ b/python/pyosaf/saAis.py @@ -198,6 +198,11 @@ else: """ super(SaNameT, self).__init__(len(name), name) + def __str__(self): + """Returns the content of SaNameT + """ + return self.value + class SaVersionT(Structure): """Contain software versions of area implementation. diff --git a/python/pyosaf/saImm.py b/python/pyosaf/saImm.py --- a/python/pyosaf/saImm.py +++ b/python/pyosaf/saImm.py @@ -71,7 +71,7 @@ def unmarshalSaImmValue(void_ptr, value_ val_ptr = SaImmValueTypeMap.get(value_type) if val_ptr and void_ptr: if val_ptr == SaNameT: - return cast(void_ptr, POINTER(val_ptr))[0].value + return str(cast(void_ptr, POINTER(val_ptr))[0]) return cast(void_ptr, POINTER(val_ptr))[0] return None diff --git a/python/pyosaf/saNtf.py b/python/pyosaf/saNtf.py --- a/python/pyosaf/saNtf.py +++ b/python/pyosaf/saNtf.py @@ -202,9 +202,10 @@ def unmarshalSaNtfValue(void_ptr, value_ val_ptr = SaNtfValueTypeMap.get(value_type) if val_ptr and void_ptr: if val_ptr == SaNameT: - return cast(void_ptr, POINTER(val_ptr))[0].value + return str(cast(void_ptr, POINTER(val_ptr))[0]) return cast(void_ptr, POINTER(val_ptr))[0] return None + class _ptrVal(Structure): _fields_ = [('dataOffset', SaUint16T), ('dataSize', SaUint16T)] ---------------------------------------------------------------------------- -- Mobile security can be enabling, not merely restricting. Employees who bring their own devices (BYOD) to work are irked by the imposition of MDM restrictions. Mobile Device Manager Plus allows you to control only the apps on BYO-devices by containerizing them, leaving personal data untouched! https://ad.doubleclick.net/ddm/clk/304595813;131938128;j _______________________________________________ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel ------------------------------------------------------------------------------ _______________________________________________ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel