473,396 Members | 2,010 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

proxy for xmlrpc calls

I'm attempting to write a proxy for xmlrpc calls.

I'm starting from this code;

class MagicObject:

def __call__(self,*args,**kwargs):
return MagicObject.__dict__['_stop'](self,self.n,*args,**kwargs)

def __getattr__(self,name):
if name in ('__str__','__repr__'): return lambda:'instance of
%s at %s' % (str(self.__class__),id(self))
if not self.__dict__.has_key('n'):self.n=[]
self.n.append(name)
return self

def _stop(self,n,*args,**kwargs):
self.n=[]
return self.default(n,*args,**kwargs)

def default(self,n,*args,**kwargs):
return 'stop',n,args,kwargs

################################################## ##############
>>c=MagicObject()
x=c.beubeb.zzzzz(1,2,3,a='bbb')
print x
('stop', ['beubeb', 'zzzzz'], (1, 2, 3), {'a': 'bbb'})

I did not write this, the source is here:
http://aspn.activestate.com/ASPN/Coo.../Recipe/435757

I want to expand this to do something like;
>>a=MagicObject()
x = a.b.c.d
Then on the last __getattr__ send a call over xmlrpc.
How do I determine when the last __getattr__ will be?

With method calls you know to send a call on xmlrpc when you hit
__call__. But if you're dealing with a getting nested attributes
what do you do? How do I know when there are no more attributes?
I thought about getting the source code from
the correct frame, but I don't think thats a good solution.

Any ideas?
Thanks in advance.
Aug 13 '06 #1
1 1320
Xavier wrote:
I'm attempting to write a proxy for xmlrpc calls.
why not use the one in the standard library?
I want to expand this to do something like;
>a=MagicObject()
x = a.b.c.d

Then on the last __getattr__ send a call over xmlrpc.
How do I determine when the last __getattr__ will be?
you can't determine that.

(and XML-RPC doesn't support attribute access either, so this sounds
like a rather pointless exercise)
I thought about getting the source code from the correct frame, but
I don't think thats a good solution.
getting the source won't help, unless you're willing to violate Python's
execution model.
Any ideas?
stick to the standard.

</F>

Aug 14 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Ben | last post by:
Hi all, I'm trying to connect to URL such as http://betty.userland.com through my LAN proxy. I've read earlier postings on this newsgroups but still i haven't been able to figure out the way to...
4
by: dcrespo | last post by:
....If the answer is Yes, can you give me an example either in the server side and the client side? I googled a lot, but I can't find nothing regarding this. A lot of thanks. Daniel
3
by: David Hirschfield | last post by:
An xmlrpc client/server app I'm writing used to be super-simple, but now threading has gotten into the mix. On the server side, threads are used to process requests from a queue as they come in....
0
by: Gustavo Rahal | last post by:
Hi I'm trying to build a xmlrpc client that uses a proxy to connect to a xmlrpc server in https. I've googled and came up with a code snippet that doesn't actually work. What is missing?
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.