Newer
Older
#!/usr/bin/env python
#coding:utf8
class RpcHandler(object):
'''
Basic RPC functions handler.
Derive this call in your handler and define some methods. All the defined
methods (including privates) are available to your peer.
'''
def __getitem__(self, name):
if hasattr(self, name):
return getattr(self, name)
else:
raise KeyError(name)
def threadless(func):
'''
Function handler decorator -- don't spawn a new thread when function is
called.
'''
func.__threaded__ = False
return func
def pure(func):
'''
Function handler decorator -- the function is a pure fonction, caller will
not pass :class:`RpcConnection` object as first call parameters.