Are decorators supported?

Richard van Bemmelen <[email protected]> Tue, 11 Feb 2014 22:25:04 +0100
Newsgroups gmane.comp.python.pyro
Message-ID <CAMEWXj1g9r=wVxA2ZEZecNLCqb6DgN515oKsTurg3iWReNsApA@mail.gmail.com>
I am trying to add a function to an instance of a Pyro4 object, like so:



def addto(instance):
    def decorator(f):
        import types
        f = types.MethodType(f, instance, instance.__class__)
        setattr(instance, f.func_name, f)
        return f
    return decorator

cs = Pyro4.Proxy("PYRONAME:example.cserv")

@addto(cs)
def getInit(self):
    print self.initCsd
    return self.initCsd


print getInit()

This code is running in a client.
It should print the content of self.initCsd on the server and on the client.
Instead, I get this on the client (nothing on the server):

<Pyro4.core._RemoteMethod object at 0x105523dd0>
<Pyro4.core._RemoteMethod object at 0x105523dd0>

So, is this supported?

Richard

------------------------------------------------------------------------------
Android apps run on BlackBerry 10
Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
Now with support for Jelly Bean, Bluetooth, Mapview and more.
Get your Android app in front of a whole new audience.  Start now.
http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk

_______________________________________________
Pyro-core mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyro-core