当前位置: 首页>>代码示例>>Python>>正文


Python SimpleXMLRPCDispatcher.system_methodHelp方法代码示例

本文整理汇总了Python中SimpleXMLRPCServer.SimpleXMLRPCDispatcher.system_methodHelp方法的典型用法代码示例。如果您正苦于以下问题:Python SimpleXMLRPCDispatcher.system_methodHelp方法的具体用法?Python SimpleXMLRPCDispatcher.system_methodHelp怎么用?Python SimpleXMLRPCDispatcher.system_methodHelp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SimpleXMLRPCServer.SimpleXMLRPCDispatcher的用法示例。


在下文中一共展示了SimpleXMLRPCDispatcher.system_methodHelp方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: rpc_handler

# 需要导入模块: from SimpleXMLRPCServer import SimpleXMLRPCDispatcher [as 别名]
# 或者: from SimpleXMLRPCServer.SimpleXMLRPCDispatcher import system_methodHelp [as 别名]
def rpc_handler(request):
	"""
	the actual handler:
	if you setup your urls.py properly, all calls to the xml-rpc service
	should be routed through here.
	If post data is defined, it assumes it's XML-RPC and tries to process as such
	Empty post assumes you're viewing from a browser and tells you about the service.
	"""
	#moving this here to see if it will fix the thread leaks
	dispatcher = SimpleXMLRPCDispatcher(allow_none=False, encoding=None) # Python 2.5

	if len(request.POST):
		dispatcher.register_function(_updateStatus, 'updateStatus')
		dispatcher.register_function(_setSceneError, 'setSceneError')
		dispatcher.register_function(_set_scene_unavailable, 'setSceneUnavailable')
		dispatcher.register_function(_markSceneComplete, 'markSceneComplete')
		dispatcher.register_function(_getConfiguration, 'getConfiguration')
		dispatcher.register_function(_getScenesToProcess, 'getScenesToProcess')
		dispatcher.register_function(_getScenesToPurge, 'getScenesToPurge')
		dispatcher.register_function(_getSceneInputPath, 'getSceneInputPath')
		dispatcher.register_function(_getDataSourceCredentials, 'getDataSourceCredentials')

		#if our leak isn't fixed, try checking to see if we need to close the response here.
		response = HttpResponse(mimetype="application/xml")
		response.write(dispatcher._marshaled_dispatch(request.raw_post_data))
	else:
		response = HttpResponse()
		response.write("<b>This is an XML-RPC Service.</b><br>")
		response.write("You need to invoke it using an XML-RPC Client!<br>")
		response.write("The following methods are available:<ul>")
		methods = dispatcher.system_listMethods()

		for method in methods:
			# right now, my version of SimpleXMLRPCDispatcher always
			# returns "signatures not supported"... :(
			# but, in an ideal world it will tell users what args are expected
			sig = dispatcher.system_methodSignature(method)

			# this just reads your docblock, so fill it in!
			help =  dispatcher.system_methodHelp(method)

			response.write("<li><b>%s</b>: [%s] %s" % (method, sig, help))

		response.write("</ul>")
		response.write('<a href="http://www.djangoproject.com/"> <img src="http://media.djangoproject.com/img/badges/djangomade124x25_grey.gif" border="0" alt="Made with Django." title="Made with Django."></a>')

	response['Content-length'] = str(len(response.content))
	return response
开发者ID:NGenetzky,项目名称:espa,代码行数:50,代码来源:rpc.py

示例2: ServerGateway

# 需要导入模块: from SimpleXMLRPCServer import SimpleXMLRPCDispatcher [as 别名]
# 或者: from SimpleXMLRPCServer.SimpleXMLRPCDispatcher import system_methodHelp [as 别名]
class ServerGateway(object):
    def __init__(self, prefix):
        self.prefix = prefix
        try:
            # Python 2.4
            self.dispatcher = SimpleXMLRPCDispatcher()
        except TypeError:
            # Python 2.5
            self.dispatcher = SimpleXMLRPCDispatcher(allow_none=False, encoding=None)

    def add_function(self, name, func):
        self.dispatcher.register_function(func, ".".join([self.prefix, name]))

    def connect( self, func=None, name=None):
        def _connector(func):
            self.add_function(not name and func.__name__ or name, func)
            return func

        if not func:
            return _connector
        else:
            _connector(func)
            return func

    def __call__(self, request, *args, **kwargs):
        if kwargs:
            raise RuntimeError("Xmlrpc server gateway cannot handle key variable argumets")

        def custom_dispatch(method, params):
            return self.dispatcher._dispatch(method, params + tuple(args))

        response = HttpResponse()
        if len(request.POST):
            response.write(self.dispatcher._marshaled_dispatch(request.raw_post_data, custom_dispatch))
        else:
            methods = self.dispatcher.system_listMethods()

            response['Content-Type'] = 'text/plain'
            for method in methods:
                # __doc__
                help = self.dispatcher.system_methodHelp(method)
                response.write("%s:\n    %s\n\n" % (method, help))

        response['Content-Length'] = str(len(response.content))
        return response
开发者ID:pombredanne,项目名称:turbion,代码行数:47,代码来源:xmlrpc.py

示例3: rpc_handler

# 需要导入模块: from SimpleXMLRPCServer import SimpleXMLRPCDispatcher [as 别名]
# 或者: from SimpleXMLRPCServer.SimpleXMLRPCDispatcher import system_methodHelp [as 别名]
def rpc_handler(request):
    """
    the actual handler:
    if you setup your urls.py properly, all calls to the xml-rpc service
    should be routed through here.
    If post data is defined, it assumes it's XML-RPC and tries to process
     as such. Empty post assumes you're viewing from a browser and tells you
     about the service.
    """

    d = SimpleXMLRPCDispatcher(allow_none=True, encoding=None)

    if len(request.body):
        d.register_function(_update_status, 'update_status')
        d.register_function(_set_product_error, 'set_scene_error')
        d.register_function(_set_product_unavailable, 'set_scene_unavailable')
        d.register_function(_mark_product_complete, 'mark_scene_complete')
        d.register_function(_handle_orders, 'handle_orders')
        d.register_function(_queue_products, 'queue_products')
        d.register_function(_get_configuration, 'get_configuration')
        d.register_function(_get_products_to_process, 'get_scenes_to_process')
        d.register_function(_get_data_points, 'get_data_points')

        response = HttpResponse(mimetype="application/xml")
        response.write(d._marshaled_dispatch(request.body))
    else:
        response = HttpResponse()
        response.write("<b>This is an XML-RPC Service.</b><br>")
        response.write("You need to invoke it using an XML-RPC Client!<br>")
        response.write("The following methods are available:<ul>")
        methods = d.system_listMethods()

        for method in methods:
            sig = d.system_methodSignature(method)

            # this just reads your docblock, so fill it in!
            help_msg = d.system_methodHelp(method)

            response.write("<li><b>%s</b>: [%s] %s" % (method, sig, help_msg))

        response.write("</ul>")

    response['Content-length'] = str(len(response.content))
    return response
开发者ID:NGenetzky,项目名称:espa,代码行数:46,代码来源:rpc.py

示例4: __init__

# 需要导入模块: from SimpleXMLRPCServer import SimpleXMLRPCDispatcher [as 别名]
# 或者: from SimpleXMLRPCServer.SimpleXMLRPCDispatcher import system_methodHelp [as 别名]
class RpcHandler:
    def __init__(self):
        self.__dispatcher = SimpleXMLRPCDispatcher(allow_none=False, encoding=None)


    def dispatcher(self):
        return self.__dispatcher

    def rpc_handler(self,request):
        """
        the actual handler:
        if you setup your urls.py properly, all calls to the xml-rpc service
        should be routed through here.
        If post data is defined, it assumes it's XML-RPC and tries to process as such
        Empty post assumes you're viewing from a browser and tells you about the service.
        """

        if len(request.POST):
            response = HttpResponse(mimetype="application/xml")
            response.write(self.__dispatcher._marshaled_dispatch(request.raw_post_data))
        else:
            response = HttpResponse()
            response.write("<b>This is an XML-RPC Service.</b><br>")
            response.write("You need to invoke it using an XML-RPC Client!<br>")
            response.write("The following methods are available:<ul>")
            methods = self.__dispatcher.system_listMethods()

            for method in methods:
                # right now, my version of SimpleXMLRPCDispatcher always
                # returns "signatures not supported"... :(
                # but, in an ideal world it will tell users what args are expected
                sig = self.__dispatcher.system_methodSignature(method)

                # this just reads your docblock, so fill it in!
                help =  self.__dispatcher.system_methodHelp(method)

                response.write("<li><b>%s</b>: [%s] %s" % (method, sig, help))

            response.write("</ul>")

        #        response['Content-length'] = str(len(response.content))
        return response
开发者ID:eross,项目名称:python_code,代码行数:44,代码来源:rpc_handler.py

示例5: HttpResponseServerError

# 需要导入模块: from SimpleXMLRPCServer import SimpleXMLRPCDispatcher [as 别名]
# 或者: from SimpleXMLRPCServer.SimpleXMLRPCDispatcher import system_methodHelp [as 别名]
        except Exception, e:
            return HttpResponseServerError()
    else:
#        response.write("<b>This is an XML-RPC Service.</b><br>")
#        response.write("You need to invoke it using an XML-RPC Client!<br>")
#        response.write("The following methods are available:<ul>")
#        methods = xmlrpcdispatcher.system_listMethods()
#        for method in methods:
#            help =  xmlrpcdispatcher.system_methodHelp(method)
#            response.write("<li><b>%s</b>:<br/><i>%s</i>" % (method, help))
#        response.write("</ul>")
#        return response
        methods = xmlrpcdispatcher.system_listMethods()
        resp=[]
        for method in methods:
            help =  xmlrpcdispatcher.system_methodHelp(method)
            resp.append({'name': method, 'help': help, 'params': ''})
        return render_to_response('rpcdoc.html',{'methods': resp})
        #return render_to_response(settings.XMLRPC_GET_TEMPLATE)

# Load up any methods that have been registered with the server in settings
for path, name in settings.XMLRPC_METHODS:
    # if "path" is actually a function, just add it without fuss
    if callable(path):
        xmlrpcdispatcher.register_function(path, name)
        continue

    # Otherwise we try and find something that we can call
    i = path.rfind('.')
    module, attr = path[:i], path[i+1:]
开发者ID:dahool,项目名称:vertaal,代码行数:32,代码来源:views.py

示例6: HttpResponse

# 需要导入模块: from SimpleXMLRPCServer import SimpleXMLRPCDispatcher [as 别名]
# 或者: from SimpleXMLRPCServer.SimpleXMLRPCDispatcher import system_methodHelp [as 别名]
    enrutadas por aqui.
    """
    response = HttpResponse()
    if request.POST:
        try:
            response.write(dispatcher._marshaled_dispatch(request.raw_post_data))
        except Exception, e:
            return HttpResponseServerError()
    else:
        #TODO Realizar descripcion del servicio
        response.write("<b>Servicio XML-RPC ofrecido por el sistema web GME.</b><br>")
        response.write("Metodos disponibles mediante XML-RPC!<br><ul>")
        methods = dispatcher.system_listMethods()
        for method in methods:
            sig = dispatcher.system_methodSignature(method)
            help =  dispatcher.system_methodHelp(method)
            #response.write("<li><b>%s</b>: [%s] %s" % (method, help))
            response.write("<li><b>%s</b>: %s</li>" % (method,help))
        response.write("</ul>")
    response.write('<a href="http://www.djangoproject.com/"> <img src="http://media.djangoproject.com/img/badges/djangomade124x25_grey.gif" border="0" alt="Made with Django." title="Made with Django."></a>')
    response['Content-length'] = str(len(response.content))
    return response

def verificar_password(usuario, password):
    '''Verifica la autenticidad del usuario en el sistema'''
    try:
        usuario = User.objects.get(username=usuario)
        if usuario.check_password(password):
            return True
        else:
            return False
开发者ID:inturiasgary,项目名称:gme,代码行数:33,代码来源:xmlrpc.py


注:本文中的SimpleXMLRPCServer.SimpleXMLRPCDispatcher.system_methodHelp方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。