Return to Home Page
      Blog     Consulting     Seminars     Calendar     Books     CD-ROMS     Newsletter     About     FAQ      Search
 

Your discussion of the proxy pattern might be enriched by using Pyro as a functioning implementation of this pattern.

Basic usage:



class myclass(Pyro.core.ObjBase):
    def __init__(self):
        Pyro.core.ObjBase.__init__(self)
        # Other initialization
    def mymethod(self, *args, **kwargs):
        # Do something with args
    def add(self, x, y):
        return x + y

# Now somewhere else, possibly on a different machine):

>>> import Pyro
>>> Pyro.core.initClient()
>>> # URI is a resource locator
>>> proxy = Pyro.core.getAttrProxyForURI(URI)
>>> proxy.add(1,2)
3
>>> proxy.mymethod(*lst, **dct)
>>>

All getattr, setattr calls are transparently proxied -- to the code using the client object, it appears exactly like the object is local (just with an uncommonly high latency).

f  e  x



Add your comment below. Use an empty line between each paragraph. Paragraphs will be automatically formatted, and single carriage returns will be respected. Use <code> to begin a code block, and </code> to end a code block. Your email address will not be visible to spam harvesters or used in any way except to contact you with further questions.

Your Email Address:

Search     Home     WebLog     Consulting     Seminars     Calendar     Books     CD-ROMS     Newsletter     About     Contact     Site Design     Server Maintenance     Powered by Zope
©2007 MindView, Inc.