While trying a workaround, I found something that looks like a bug :
standard python methods cannot be applied on a dictionary passed to a
service function.

Try this example, based on the one at 
http://sebulbasvn.googlecode.com/svn/trunk/rpyc/demos/time/,
with the following modifications:

time_service.py:
import time
from rpyc import Service
class TimeService(Service):
    def exposed_get_utc(self):
        return time.time()
    def exposed_get_time(self):
        return time.ctime()
    def exposed_dico(self, dico):
        return dico['key']

client.py:
import rpyc
c = rpyc.connect_by_service("TIME")
print "server's time is", c.root.get_time()
dico = {'key':0}
print "dico key =", c.root.dico(dico)

Is it a bug or am I missing something?

Antoine.

On Mar 4, 5:40 pm, Antoine <[email protected]> wrote:
> Hi,
>
> is it possible to expose a class method like this:
>
>     class AService(rpyc.Service):
>         class exposed_A(A):
>             @classmethod
>             def exposed_initialize(cls, *args, **kwargs):
>                 return cls.initialize(*args, **kwargs)
>
> I get this error:
>
> /Volumes/DATA/Users/dechaume/Codes/pod/jpod/src/rpyc/core/vinegar.py:
> 42: DeprecationWarning: BaseException.message has been deprecated as
> of Python 2.6
>   attrval = getattr(val, name)
> ======= Remote traceback =======
> Traceback (most recent call last):
>   File "/Volumes/DATA/Users/dechaume/Codes/pod/jpod/src/rpyc/core/
> protocol.py", line 223, in _dispatch_request
>     res = self._HANDLERS[handler](self, *args)
>   File "/Volumes/DATA/Users/dechaume/Codes/pod/jpod/src/rpyc/core/
> protocol.py", line 432, in _handle_getattr
>     return self._access_attr(oid, name, (), "_rpyc_getattr",
> "allow_getattr", getattr)
>   File "/Volumes/DATA/Users/dechaume/Codes/pod/jpod/src/rpyc/core/
> protocol.py", line 395, in _access_attr
>     raise AttributeError("cannot access %r" % (name,))
> AttributeError: cannot access 'get'
>
> Antoine.

Reply via email to