def __init__(self, services, tns, name=None, in_protocol=None, out_protocol=None, interface=None): self.services = tuple(services) self.tns = tns self.name = name if self.name is None: self.name = self.__class__.__name__.split('.')[-1] self.event_manager = EventManager(self) self.error_handler = None self.interface = Interface(self) self.in_protocol = in_protocol self.out_protocol = out_protocol if self.in_protocol is None: from spyne.protocol import ProtocolBase self.in_protocol = ProtocolBase(self) else: self.in_protocol.set_app(self) if self.out_protocol is None: from spyne.protocol import ProtocolBase self.out_protocol = ProtocolBase(self) else: self.out_protocol.set_app(self) register_application(self) self.reinitialize()
def __init__(self, cls_name, cls_bases, cls_dict): super(ServiceBaseMeta, self).__init__(cls_name, cls_bases, cls_dict) self.__has_aux_methods = self.__aux__ is not None 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'): descriptor = v(_default_function_name=k) # these two lines are needed for staticmethod wrapping to work setattr(self, k, staticmethod(descriptor.function)) descriptor.reset_function(getattr(self, k)) self.public_methods[k] = descriptor if descriptor.aux is None: if self.__has_aux_methods and self.__aux__ is None: raise Exception( "you can't mix primary and " "auxiliary methods in a single service definition." ) else: self.__has_aux_methods = True for p in descriptor.patterns: p.endpoint = k
def __init__(self, services, tns, name=None, in_protocol=None, out_protocol=None, interface=None): self.services = tuple(services) self.tns = tns self.name = name if self.name is None: self.name = self.__class__.__name__.split('.')[-1] self.event_manager = EventManager(self) self.error_handler = None self.interface = Interface(self) self.in_protocol = in_protocol self.out_protocol = out_protocol if self.in_protocol is None: from spyne.protocol import ProtocolBase self.in_protocol = ProtocolBase() self.in_protocol.set_app(self) # FIXME: this normally is another parameter to set_app but it's kept # separate for backwards compatibility reasons. self.in_protocol.message = self.in_protocol.REQUEST if self.out_protocol is None: from spyne.protocol import ProtocolBase self.out_protocol = ProtocolBase() self.out_protocol.set_app(self) # FIXME: this normally is another parameter to set_app but it's kept # separate for backwards compatibility reasons. self.out_protocol.message = self.out_protocol.RESPONSE register_application(self) self.reinitialize()