/[escript]/trunk/escript/py_src/modelframe.py
ViewVC logotype

Diff of /trunk/escript/py_src/modelframe.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 920 by gross, Thu Jan 4 00:00:40 2007 UTC revision 926 by gross, Fri Jan 12 06:31:37 2007 UTC
# Line 570  class ParameterSet(LinkableObject): Line 570  class ParameterSet(LinkableObject):
570                  param.appendChild(esysxml.createDataNode('Value', ' '.join([str(x) for x in value]) ))                  param.appendChild(esysxml.createDataNode('Value', ' '.join([str(x) for x in value]) ))
571              elif isinstance(value, (str, bool, int, float, type(None))):              elif isinstance(value, (str, bool, int, float, type(None))):
572                  param.appendChild(esysxml.createDataNode('Value', str(value)))                  param.appendChild(esysxml.createDataNode('Value', str(value)))
573                elif isinstance(value, dict):
574                     dic = esysxml.createElement('dictionary')
575                     if len(value.keys())>0:
576                         dic.setAttribute('key_type', value.keys()[0].__class__.__name__)
577                         dic.setAttribute('value_type', value[value.keys()[0]].__class__.__name__)
578                     for k,v in value.items():
579                        i=esysxml.createElement('item')
580                        i.appendChild(esysxml.createDataNode('key', k))
581                        i.appendChild(esysxml.createDataNode('value', v))
582                        dic.appendChild(i)
583                     param.appendChild(dic)
584              else:              else:
585                    print value
586                  raise ValueError("cannot serialize %s type to XML."%str(value.__class__))                  raise ValueError("cannot serialize %s type to XML."%str(value.__class__))
587    
588              node.appendChild(param)              node.appendChild(param)

Legend:
Removed from v.920  
changed lines
  Added in v.926

  ViewVC Help
Powered by ViewVC 1.1.26