def method_ref(self, method): # Execute the right function (from xml-rpc request) in the right class. # NOTE: All functions should do their own logging log_debug(3, self.server, method) if method[-8:] == '.__str__': # Ignore these, they are just some code trying to stringify an # XML-RPC function log_error("Ignoring call for method", method) raise rhnFault(-1, "Ignoring call for a __str__ method", explain=0) if self.server is None: raise UnknownXML("Method `%s' is not bound to a server " "(server = %s)" % (method, self.server)) classes = self.servers[self.server] if classes is None: raise UnknownXML("Server %s is not a valid XML-RPC receiver" % (self.server, )) try: classname, funcname = string.split(method, '.', 1) except: raise_with_tb( UnknownXML("method '%s' doesn't have a class and function" % (method, )), sys.exc_info()[2]) if not classname or not funcname: raise UnknownXML(method) log_debug(4, "Class name: %s; function name: %s" % (classname, funcname)) c = classes.get(classname) if c is None: raise UnknownXML("class %s.%s is not defined (function = %s)" % (self.server, classname, funcname)) # Initialize the handlers object serverHandlers = c() # we need this for sat handler serverHandlers.remote_hostname = self.req.get_remote_host( apache.REMOTE_DOUBLE_REV) f = serverHandlers.get_function(funcname) if f is None: raise UnknownXML("function: %s invalid" % (method, )) # Send the client this server's capabilities rhnCapability.set_server_capabilities() return f
def method_ref(self, method): # Execute the right function (from xml-rpc request) in the right class. # NOTE: All functions should do their own logging log_debug(3, self.server, method) if method[-8:] == '.__str__': # Ignore these, they are just some code trying to stringify an # XML-RPC function log_error("Ignoring call for method", method) raise rhnFault(-1, "Ignoring call for a __str__ method", explain=0) if self.server is None: raise UnknownXML("Method `%s' is not bound to a server " "(server = %s)" % (method, self.server)) classes = self.servers[self.server] if classes is None: raise UnknownXML("Server %s is not a valid XML-RPC receiver" % (self.server,)) try: classname, funcname = string.split(method, '.', 1) except: raise UnknownXML("method '%s' doesn't have a class and function" % (method,)), None, sys.exc_info()[2] if not classname or not funcname: raise UnknownXML(method) log_debug(4, "Class name: %s; function name: %s" % (classname, funcname)) c = classes.get(classname) if c is None: raise UnknownXML("class %s.%s is not defined (function = %s)" % ( self.server, classname, funcname)) # Initialize the handlers object serverHandlers = c() # we need this for sat handler serverHandlers.remote_hostname = self.req.get_remote_host(apache.REMOTE_DOUBLE_REV) f = serverHandlers.get_function(funcname) if f is None: raise UnknownXML("function: %s invalid" % (method,)) # Send the client this server's capabilities rhnCapability.set_server_capabilities() return f