xmlrcp - how to marshall objects

MRAB python at mrabarnett.plus.com
Fri Feb 5 13:20:40 EST 2010


Jean-Michel Pichavant wrote:
> Jean-Michel Pichavant wrote:
>> Deos anyone knows where to find an code sample describing how to 
>> implement the interface to marshall one object into XMLRPC compliant 
>> structures ?
>>
>> I googled without any success, and what google does not find does not 
>> exist.
>>
>> Let say I have this very simple class:
>>
>> class Point:
>>    def __init__(self, x, y):
>>    self.x = x
>>    self.y = y
>>
>>
>> I've looked into xmlrpc code, I see  2 options:
>> 1/ override the Marshaller class of client and server
>> 2/ looks like the lib is supporting a WRAPPER list system, it uses to 
>> Marshall Datetime & Binary object. Can it be possible to add its own 
>> class (could require to emplement the 'encode' method)
>>
>> I sense I will spend much more time than required unless someone is 
>> pointing me in the right direction.
>>
>> JM
>>
> I realized I gave a poor example, actually the Point object is marshable 
> (marshallable ? like to invent new words), xmlrpc will try to marshall 
> using __dict__ if possible.
> 
"marshallable". Just pick a verb and add -able.

There was an advertisement by British Gas in which someone said that his
gas central heating was very turn-off-and-on-able! :-)

> import os
> 
> class Point:
>   def __init__(self, x, y):
>   self.x = x
>   self.y = y
>   self.notMarshallable = os
> 



More information about the Python-list mailing list