webapp2.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:webapp2 作者: GoogleCloudPlatform 项目源码 文件源码
def set_globals(self, app=None, request=None):
        """Registers the global variables for app and request.

        If :mod:`webapp2_extras.local` is available, the app and request
        class attributes are assigned to a proxy object that returns them
        using thread-local, making the application thread-safe. This can also
        be used in environments that don't support threading.

        If :mod:`webapp2_extras.local` is not available, app and request will
        be assigned directly as class attributes. This should only be used in
        non-threaded environments (e.g., App Engine Python 2.5).

        :param app:
            A :class:`WSGIApplication` instance.
        :param request:
            A :class:`Request` instance.
        """
        if _local is not None:  # pragma: no cover
            _local.app = app
            _local.request = request
        else:  # pragma: no cover
            WSGIApplication.app = WSGIApplication.active_instance = app
            WSGIApplication.request = request
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号