[mod_python] Vampire and XML-RPC example service

Graham Dumpleton grahamd at dscpl.com.au
Thu Oct 27 05:34:19 EDT 2005

On 27/10/2005, at 1:30 AM, Ian Stokes-Rees wrote:

> Graham Dumpleton wrote:
>> XML-RPC by definition is a remote procedure calling mechanism.
>> A variable such as string is not a callable object. Ie., it doesn't 
>> work
>> like publisher does whereby variables are automatically converted
>> to strings are returned.
> That makes perfect sense, I was just wondering if Vampire did 
> something automagically (I suppose xmlrpclib on the client side would 
> have to reciprocate).  I only was trying it out since the variables 
> were contained in the example object in xmlrpc_service.py, so I was 
> wondering if that implied they were accessible over XML-RPC.

The variables were probably there and not explicitly hidden using an
underscore prefix either to test that they couldn't be accessed, or
also possibly when I was trying out the idea of them being accessible.

What I experimented with was the idea that if one made a function
call on client side where the target turned out to be a variable that
the actual variable was returned. Ie., much like mod_python.publisher
except the actual value was returned and not a string representation
of it.

I decided not to allow it as I felt it was too automagic. You also
ended up with difficult decisions as to what is the appropriate
thing to do if the target is a generator or a class instance without
an explicit __call__() method, but it has a __str__() method. Overall,
I felt it much more sense that if someone wanted to expose a variable
that they make an accessor function for it. That way you aren't second
guessing what may be required and presenting a solution that be hard
for a user to override.


More information about the Mod_python mailing list