Be able to use python properties in the context of setting/getting
Thank you very much I'll try to apply this fix today
From: Joshua Boverhof [mailto:JRBoverhof@lbl.gov]
Sent: Monday, June 19, 2006 10:57 PM
To: Hermann Himmelbauer
Cc: email@example.com; Shay Halsband
Subject: Re: [Pywebsvcs-talk] class property
For parsing it will work.
For serialization it will not work since the ZSI ComplexType typecode
expects all data to be in the instance __dict__.
Here is a patch to make this work. I'll probably add this to svn soon.
Obviously you'll have to use "new-style" classes to make this work.
$ svn diff TCcompound.py
--- TCcompound.py (revision 1237)
+++ TCcompound.py (working copy)
@@ -336,10 +336,14 @@
elif n is not None:
- if self.pyclass:
+ if self.pyclass and type(self.pyclass) is type:
+ f = lambda attr: getattr(pyobj, attr, None)
+ elif self.pyclass:
d = pyobj.__dict__
+ f = lambda attr: d.get(attr)
d = pyobj
+ f = lambda attr: pyobj.get(attr)
if TypeCode.typechecks and type(d) != types.DictType:
raise TypeError("Classless struct didn't get
@@ -366,7 +370,8 @@
# Regular handling of declared elements
aname = what.aname
- v = d.get(aname)
+ #v = d.get(aname)
+ v = f(aname)
indx += 1
if what.minOccurs == 0 and v is None:
On Jun 19, 2006, at 10:52 AM, Hermann Himmelbauer wrote:
On Monday 19 June 2006 17:34, Shay Halsband wrote:
Thanks for the swift reply,
However this is not what I meant for.
All I wish for is to take the outcome of the properties get function
result, in my case a string and send it.
Ok, now it's clear to me. That should be easy to do.
Just have a look at the examples section in the ZSI documentation,
should find an example that describes how to create simple typecodes.
GPG key ID: 299893C7 (on keyservers)
FP: 0124 2584 8809 EF2A DBF9 4902 64B4 D16B 2998 93C7
Pywebsvcs-talk mailing list