From 80e98722df076de1f6e0f337b88b32957e220eda Mon Sep 17 00:00:00 2001 From: Andreas Maier Date: Fri, 29 Dec 2017 09:13:37 +0100 Subject: [PATCH] Applied review comments on previous commit. Signed-off-by: Andreas Maier --- docs/changes.rst | 4 +++- pywbem/cim_obj.py | 16 +++++++++------- pywbem/cim_types.py | 5 +++-- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/docs/changes.rst b/docs/changes.rst index 84bb791a1..fb0e45e64 100644 --- a/docs/changes.rst +++ b/docs/changes.rst @@ -224,7 +224,9 @@ Cleanup * The `atomic_to_cim_xml()` function and any generated CIM-XML now generates boolean values in upper case 'TRUE' and 'FALSE', following the recommendation - in DSP0201. + in DSP0201. Previously, boolean values were produced in lower case. This + change is compatible for WBEM servers that meet the requirement of DSP0201 + to treat boolean values case-insensitively. Build, test, quality ^^^^^^^^^^^^^^^^^^^^ diff --git a/pywbem/cim_obj.py b/pywbem/cim_obj.py index 3a8f0c53d..5ad03a732 100644 --- a/pywbem/cim_obj.py +++ b/pywbem/cim_obj.py @@ -787,13 +787,15 @@ def _cim_keybinding(key, value): # Note: The CIM data types are derived from the built-in types, so we # cannot use isinstance() for this test. - # Ideally, we won't accept keybinding values specified as Python number - # typed values, but require a CIM data type (e.g. Uint32 or Real32). + # Ideally, pywbem won't accept keybinding values specified as Python + # number typed values, but require a CIM data type (e.g. Uint32 or + # Real32). # However, there are two reasons for continuing to allow that: - # * It was allowed in earlier versions of pywbem - # * When parsing the (untyped) WBEM URI of an instance path, we get - # int or float values without size, and don't have any way to - # get hold of the size information. + # * It was allowed in earlier versions of pywbem. + # * Parsing the (untyped) WBEM URI of an instance path, results in + # int or float values without size, and the size information + # to automatically convert that into numeric CIM data types is + # not available. return value if isinstance(value, (CIMClass, CIMInstance)): @@ -5821,7 +5823,7 @@ def cimvalue(value, type): return None if type is None: - # The following may raise TypeError or ValueError. This enforces that + # The following may raise TypeError or ValueError. This ensures that # Python number typed values cannot be provided without specifing # their CIM type. type = cimtype(value) diff --git a/pywbem/cim_types.py b/pywbem/cim_types.py index b6eb6af9f..fe1059fb8 100644 --- a/pywbem/cim_types.py +++ b/pywbem/cim_types.py @@ -860,7 +860,8 @@ def type_from_name(type_name): def atomic_to_cim_xml(obj): """ - Convert an atomic scalar value to a CIM-XML string and return that string. + Convert an "atomic" scalar value to a CIM-XML string and return that + string. The returned CIM-XML string is ready for use as the text of a CIM-XML 'VALUE' element. @@ -868,7 +869,7 @@ def atomic_to_cim_xml(obj): Parameters: obj (:term:`CIM data type`, :term:`number`, :class:`py:datetime`): - The input value. May be `None`. + The "atomic" input value. May be `None`. Must not be an array/list/tuple. Must not be a :ref:`CIM object`.