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


Python SimpleXMLRPCDispatcher.register_multicall_functions方法代码示例

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


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

示例1: XMLRPCDispatcher

# 需要导入模块: from SimpleXMLRPCServer import SimpleXMLRPCDispatcher [as 别名]
# 或者: from SimpleXMLRPCServer.SimpleXMLRPCDispatcher import register_multicall_functions [as 别名]
class XMLRPCDispatcher(Resource):
    '''A Resource that knows how to host an XMLRPCObject and serve it'''
    
    def __init__(self, application, request, response, session, instance=None, methods=[], allow_none=True, encoding=None):
        '''initializes this dispatcher which can handle XMLRPC requests.'''
        if not instance: raise ValueError("You must pass in a non-null object which we will serve")
        super(XMLRPCDispatcher, self).__init__(application, request, response, session)
        self.dispatcher = SimpleXMLRPCDispatcher(allow_none=allow_none, encoding=encoding)
        self.dispatcher.register_instance(instance)
        for method in methods:
            self.dispatcher.register_function(method)
        self.dispatcher.register_introspection_functions()
        self.dispatcher.register_multicall_functions()
         
    @POST
    @Route("/{path:.*}")
    def post(self, path):
        '''
        Attempts to process all posts as XMLRPC Requests which are then
        dispatched to the XMLRPCObject. Most of the code was taken from 
        SimpleXMLRPCServer with modifications to make it compatible with
        Gates
        '''
        try:
            data = self.request.body
            response = self.dispatcher._marshaled_dispatch(
                data, getattr(self.dispatcher, '_dispatch', None)
            )
        except Exception as e: # This should only happen if the module is buggy
            # internal error, report as Internal HTTP Server error
            traceback.print_exc(e)
            abort(500, "XMLRPC Application Error! You shouldn't be seeing this. We're sorry.")
        else:
            # We got a valid XML RPC response
            self.response.type = "text/xml"
            self.response.write(response)
开发者ID:atlas,项目名称:gates,代码行数:38,代码来源:__init__.py

示例2: SimpleXMLRPCDispatcher

# 需要导入模块: from SimpleXMLRPCServer import SimpleXMLRPCDispatcher [as 别名]
# 或者: from SimpleXMLRPCServer.SimpleXMLRPCDispatcher import register_multicall_functions [as 别名]
#            Sean Myers <[email protected]>
# Copyright 2008 American Research Institute, Inc.

from SimpleXMLRPCServer import SimpleXMLRPCDispatcher
from django.http import HttpResponse
from pr_services.rpc.service import ServiceManagers
import facade
import settings
import sys

if sys.version_info[:2] == (2, 4):
    dispatcher = SimpleXMLRPCDispatcher()
elif sys.version_info[:2] >= (2, 5):
    dispatcher = SimpleXMLRPCDispatcher(allow_none = True, encoding = 'utf-8')
dispatcher.register_introspection_functions()
dispatcher.register_multicall_functions()

def gateway(request):
    response = HttpResponse()
    if len(request.POST):
        response = HttpResponse(mimetype="application/xml")  # Cleaner to reinstantiate than to add seemingly useless else clause
        response.write(dispatcher._marshaled_dispatch(request.raw_post_data))
    elif settings.DEBUG:
        response.write("<b>This is an XML-RPC Service.</b><br>")
        response.write("The following methods are available:<ul>")
        methods = dispatcher.system_listMethods()

        for method in methods:
            help =  dispatcher.system_methodHelp(method)
            response.write("<li><b>%s</b>: <pre>%s</pre>" % (method, help))
        response.write("</ul>")
开发者ID:AmericanResearchInstitute,项目名称:poweru-server,代码行数:33,代码来源:xmlrpc.py


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