From: Karsten B. <ka...@ka...> - 2003-07-07 11:57:22
|
Hi, regarding to some other postings to this list the following code should work, but throws an exception. Why? *********** from cStringIO import StringIO from ZSI import * class Level1: def __init__(self, parm1=None, parm2=None): self.parm1 = parm1 self.parm2 = parm2 Level1.typecode = TC.Struct(Level1, [ TC.String('parm1'), TC.String('parm2') ], 'Level1') class Level2: def __init__(self, level1=None): self.level1 = level1 Level2.typecode = TC.Struct(Level2, [ Level1.typecode ], 'Level2') myout = StringIO() level1 = Level1("parameter1", "parameter2") level2 = Level2(level1) sw = SoapWriter(myout) sw.serialize(level2) #exception, but serializing level1 works sw.close() print myout.getvalue() ************** Traceback (most recent call last): File "test.py", line 20, in ? sw.serialize(level2) #exception, but serializing level1 works File "ZSI/writer.py", line 72, in serialize typecode.serialize(self, pyobj, **kw) File "ZSI/TCcompound.py", line 144, in serialize self.cb(sw, pyobj, **kw) File "ZSI/TCcompound.py", line 174, in cb raise Exception('Serializing %s.%s, %s %s' % Exception: Serializing Level2.Level1, AttributeError 'NoneType' object has no attribute '__dict__' ************** Thanks, Karsten |