コード例 #1
0
ファイル: views.py プロジェクト: znanl/uliweb
def xmlrpc():
    import uliweb.contrib.xmlrpc as rpc
    import xmlrpclib
    from werkzeug import Response
    from uliweb.utils.common import log
    from uliweb import application as app, response

    p, m = xmlrpclib.loads(request.data)
    try:
        f = rpc.__xmlrpc_functions__.get(m)
        if f:
            mod, handler_cls, handler = app.prepare_request(request, f)
            result = app.call_view(mod,
                                   handler_cls,
                                   handler,
                                   request,
                                   response,
                                   _wrap_result,
                                   args=p)
            xml = xmlrpclib.dumps((result, ), methodresponse=1)
        else:
            xml = xmlrpclib.dumps(xmlrpclib.Fault(
                -32400, 'system error: Cannot find or call %s' % m),
                                  methodresponse=1)
            log.debug('xmlrpc error: Cannot find or call %s' % m)
    except Exception as e:
        xml = xmlrpclib.dumps(xmlrpclib.Fault(-32400, 'system error: %s' % e),
                              methodresponse=1)
        log.exception('xmlrpc error')
    response = Response(xml, content_type='text/xml; charset=utf-8')
    return response
コード例 #2
0
ファイル: views.py プロジェクト: 08haozi/uliweb
 def _call(func, args):
     rule = SimpleRule()
     rule.endpoint = func
     mod, handler_cls, handler = app.prepare_request(request, rule)
     result = app.call_view(mod, handler_cls, handler, request, response, _wrap_result, kwargs=args)
     r = _fix_soap_datatype(result)
     return r
コード例 #3
0
ファイル: views.py プロジェクト: zhangtianyi1234/uliweb
 def _call(func, args):
     rule = SimpleRule()
     rule.endpoint = func
     mod, handler_cls, handler = app.prepare_request(request, rule)
     result = app.call_view(mod,
                            handler_cls,
                            handler,
                            request,
                            response,
                            _wrap_result,
                            kwargs=args)
     r = _fix_soap_datatype(result)
     return r
コード例 #4
0
ファイル: views.py プロジェクト: 08haozi/uliweb
def xmlrpc():
    import uliweb.contrib.xmlrpc as rpc
    import xmlrpclib
    from werkzeug import Response
    from uliweb.utils.common import log
    from uliweb import application as app, response
    
    p, m = xmlrpclib.loads(request.data)
    try:
        f = rpc.__xmlrpc_functions__.get(m)
        if f:
            mod, handler_cls, handler = app.prepare_request(request, f)
            result = app.call_view(mod, handler_cls, handler, request, response, _wrap_result, args=p)
            xml = xmlrpclib.dumps((result,), methodresponse=1)
        else:
            xml = xmlrpclib.dumps(xmlrpclib.Fault(-32400, 'system error: Cannot find or call %s' % m), methodresponse=1)
            log.debug('xmlrpc error: Cannot find or call %s' % m)
    except Exception, e:
        xml = xmlrpclib.dumps(xmlrpclib.Fault(-32400, 'system error: %s' % e), methodresponse=1)
        log.exception('xmlrpc error')
コード例 #5
0
ファイル: views.py プロジェクト: bobgao/uliweb
 def _call(func, args):
     mod, handler_cls, handler = app.prepare_request(request, func)
     result = app.call_view(mod, handler_cls, handler, request, response, _wrap_result, kwargs=args)
     r = _fix_soap_datatype(result)
     return r