Skip to content

Commit

Permalink
Applied review comments on previous commit.
Browse files Browse the repository at this point in the history
Signed-off-by: Andreas Maier <maiera@de.ibm.com>
  • Loading branch information
andy-maier committed Dec 29, 2017
1 parent 2f376d0 commit 80e9872
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
4 changes: 3 additions & 1 deletion docs/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
^^^^^^^^^^^^^^^^^^^^
Expand Down
16 changes: 9 additions & 7 deletions pywbem/cim_obj.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)):
Expand Down Expand Up @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions pywbem/cim_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -860,15 +860,16 @@ 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.
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`.
Expand Down

0 comments on commit 80e9872

Please sign in to comment.