예제 #1
0
    def __init__(self, services, tns, interface, in_protocol, out_protocol,
                                        name=None, supports_fanout_methods=False):

        self.services = services
        self.tns = tns
        self.name = name
        self.supports_fanout_methods = supports_fanout_methods

        if self.name is None:
            self.name = self.__class__.__name__.split('.')[-1]

        self.in_protocol = in_protocol
        self.in_protocol.set_app(self)

        self.out_protocol = out_protocol
        self.out_protocol.set_app(self)

        self.interface = interface
        self.interface.set_app(self)

        self.__public_methods = {}
        self.__classes = {}

        self.event_manager = EventManager(self)
        self.error_handler = None
예제 #2
0
파일: _base.py 프로젝트: rch/rpclib
    def __init__(self, app):
        self.app = app
        self.app.transport = self.transport
        if app.supports_fanout_methods and not self.supports_fanout_methods:
            logger.warning("""Your application is in fanout mode.
            note that in fanout mode, only the response from the last
            call will be returned.""")

        self.event_manager = EventManager(self)
예제 #3
0
파일: service.py 프로젝트: rch/rpclib
    def __init__(self, cls_name, cls_bases, cls_dict):
        super(ServiceBaseMeta, self).__init__(cls_name, cls_bases, cls_dict)

        self.public_methods = {}
        self.event_manager = EventManager(
            self, self.__get_base_event_handlers(cls_bases))

        for k, v in cls_dict.items():
            if hasattr(v, '_is_rpc'):
                # these three lines are needed for staticmethod wrapping to work
                descriptor = v(_default_function_name=k)
                setattr(self, k, staticmethod(descriptor.function))
                descriptor.reset_function(getattr(self, k))

                self.public_methods[k] = descriptor
예제 #4
0
    def __init__(self, app=None, validator=None):
        self.__app = None

        self.set_app(app)
        self.event_manager = EventManager(self)
        self.set_validator(validator)