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


Python WsgiApplication.__call__方法代码示例

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


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

示例1: __call__

# 需要导入模块: from spyne.server.wsgi import WsgiApplication [as 别名]
# 或者: from spyne.server.wsgi.WsgiApplication import __call__ [as 别名]
    def __call__(self, request):
        retval = self.HttpResponseObject()

        def start_response(status, headers):
            # Status is one of spyne.const.http
            status, reason = status.split(' ', 1)

            retval.status_code = int(status)
            for header, value in headers:
                retval[header] = value

        environ = request.META.copy()

        # FIXME: No idea what these two did.
        #        They were commented out to fix compatibility issues with
        #        Django-1.2.x
        # See http://github.com/arskom/spyne/issues/222.

        # If you don't override wsgi.input django and spyne will read
        # the same buffer twice. If django read whole buffer spyne
        # would hang waiting for extra request data. Use DjangoServer instead
        # of monkeypatching wsgi.inpu.

        #environ['wsgi.input'] = request
        #environ['wsgi.multithread'] = False

        response = WsgiApplication.__call__(self, environ, start_response)
        self.set_response(retval, response)

        return retval
开发者ID:josjevv,项目名称:spyne,代码行数:32,代码来源:django.py

示例2: __call__

# 需要导入模块: from spyne.server.wsgi import WsgiApplication [as 别名]
# 或者: from spyne.server.wsgi.WsgiApplication import __call__ [as 别名]
    def __call__(self, request):
        django_response = HttpResponse()

        def start_response(status, headers):
            status, reason = status.split(' ', 1)

            django_response.status_code = int(status)
            for header, value in headers:
                django_response[header] = value

        environ = request.META.copy()
        environ['wsgi.input'] = request
        environ['wsgi.multithread'] = False
        response = WsgiApplication.__call__(self, environ, start_response)
        #TODO: можно сказать, что это костыль, без него не работает.
        #Может быть когда то spyne научится делать это сам, как надо sopa клиенту qiwi
        data = (u"".join(response))\
                    .replace('tns:updateBillResult', 'updateBillResult')

        if self.debug_mode is None:
            self.debug_mode = bool(settings.DEBUG)

        if self.debug_mode:
            logger = logging.getLogger(LOGGER_NAME)
            logger.debug(u'soap response content: {0}'.format(data))

        django_response.content = data
        if django_response.has_header('Content-Length'):
            django_response['Content-Length'] = len(data)

        return django_response
开发者ID:jcfromsiberia,项目名称:qiwi-for-django,代码行数:33,代码来源:handler.py

示例3: __call__

# 需要导入模块: from spyne.server.wsgi import WsgiApplication [as 别名]
# 或者: from spyne.server.wsgi.WsgiApplication import __call__ [as 别名]
    def __call__(self, request):
        pyramid_response = Response()
        def start_response(status, headers):
            status, reason = status.split(' ', 1)

            pyramid_response.status_int = int(status)
            pyramid_response.headers["Cache-Control"] = "no-cache, must-revalidate"
            pyramid_response.headers["Expires"] = "Sat, 26 Jul 1997 05:00:00 GMT"
            for header, value in headers:
                pyramid_response.headers[header] = value

        response = WsgiApplication.__call__(self, request, start_response)
        pyramid_response.body = "\n".join(response)
        return pyramid_response
开发者ID:Bluehorn,项目名称:spyne,代码行数:16,代码来源:__init__.py

示例4: __call__

# 需要导入模块: from spyne.server.wsgi import WsgiApplication [as 别名]
# 或者: from spyne.server.wsgi.WsgiApplication import __call__ [as 别名]
    def __call__(self, request):
        retval = Response()

        def start_response(status, headers):
            status, reason = status.split(' ', 1)

            retval.status_int = int(status)
            for header, value in headers:
                retval.headers[header] = value

        response = WsgiApplication.__call__(self, request, start_response)
        retval.body = "".join(response)

        return retval
开发者ID:Bernie,项目名称:spyne,代码行数:16,代码来源:pyramid.py

示例5: __call__

# 需要导入模块: from spyne.server.wsgi import WsgiApplication [as 别名]
# 或者: from spyne.server.wsgi.WsgiApplication import __call__ [as 别名]
    def __call__(self, request):
        retval = self.HttpResponse

        def start_response(status, headers):
            status, reason = status.split(' ', 1)

            retval.status_code = int(status)
            for header, value in headers:
                retval[header] = value

        environ = request.META.copy()
        environ['wsgi.input'] = request
        environ['wsgi.multithread'] = False

        response = WsgiApplication.__call__(self, environ, start_response)
        self.set_response(self, retval, response)

        return retval
开发者ID:norox,项目名称:spyne,代码行数:20,代码来源:django.py

示例6: __call__

# 需要导入模块: from spyne.server.wsgi import WsgiApplication [as 别名]
# 或者: from spyne.server.wsgi.WsgiApplication import __call__ [as 别名]
    def __call__(self, request):
        django_response = HttpResponse()

        def start_response(status, headers):
            status, reason = status.split(' ', 1)

            django_response.status_code = int(status)
            for header, value in headers:
                django_response[header] = value

        environ = request.META.copy()
        environ['wsgi.input'] = request
        environ['wsgi.multithread'] = False

        response = WsgiApplication.__call__(self, environ, start_response)

        django_response.content = "\n".join(response)

        return django_response
开发者ID:Bluehorn,项目名称:spyne,代码行数:21,代码来源:__init__.py


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