|
From: <ba...@us...> - 2007-02-22 00:19:50
|
Revision: 444
http://svn.sourceforge.net/omc/?rev=444&view=rev
Author: bartw
Date: 2007-02-21 16:19:49 -0800 (Wed, 21 Feb 2007)
Log Message:
-----------
fixed stringarray properties and parameters so that array elements can include commas
Modified Paths:
--------------
tools/trunk/yawn/yawn.py
Modified: tools/trunk/yawn/yawn.py
===================================================================
--- tools/trunk/yawn/yawn.py 2007-02-20 21:59:16 UTC (rev 443)
+++ tools/trunk/yawn/yawn.py 2007-02-22 00:19:49 UTC (rev 444)
@@ -60,7 +60,10 @@
for item in x:
if item is not x[0]:
rval+= ', '
- rval+= _val2str(item)
+ strItem = _val2str(item)
+ if type(item) in types.StringTypes:
+ strItem = '"' + strItem + '"'
+ rval+= strItem
rval+= '}'
return rval
elif type(x) == datetime:
@@ -759,10 +762,15 @@
if metaProp.is_array:
if type(propVal) is not list:
propVal = propVal.strip()
- propVal = propVal.strip('{}')
+ propVal = propVal.strip('{}[]')
propVal = propVal.strip()
- propVal = propVal.split(',')
- propVal = [x.strip() for x in propVal]
+ if len(propVal) > 2 and dt == 'string' \
+ and propVal[0] == '"' and propVal[-1] == '"' :
+ propVal = '['+propVal+']'
+ propVal = eval(propVal)
+ else:
+ propVal = propVal.split(",")
+ propVal = [x.strip() for x in propVal]
propVal = [pywbem.tocimobj(dt, x) for x in propVal]
inst.properties[propName] = propVal
else:
@@ -933,7 +941,10 @@
else:
ht+= '<input type=text size=50 name="'+fPropName+'"'
if oldVal is not None:
- ht+= ' value="'+_val2str(oldVal)+'"'
+ strValue = _val2str(oldVal)
+ if isinstance(oldVal,list):
+ strValue = strValue.replace('"','"')
+ ht+= ' value="'+strValue+'"'
ht+= '>'
ht+= '</td></tr>'
@@ -1025,10 +1036,15 @@
if metaParm.is_array:
if type(paramVal) is not list:
paramVal = paramVal.strip()
- paramVal = paramVal.strip('{}')
+ paramVal = paramVal.strip('{}[]')
paramVal = paramVal.strip()
- paramVal = paramVal.split(',')
- paramVal = [x.strip() for x in paramVal]
+ if len(paramVal) > 2 and dt == 'string' \
+ and paramVal[0] == '"' and paramVal[-1] == '"' :
+ paramVal = '['+paramVal+']'
+ paramVal = eval(paramVal)
+ else:
+ paramVal = paramVal.split(",")
+ paramVal = [x.strip() for x in paramVal]
if metaParm.reference_class is not None:
paramVal = [_decodeObject(x) for x in paramVal]
else:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|