wsgi.py 文件源码

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

项目:masakari 作者: openstack 项目源码 文件源码
def _get_method(self, request, action, content_type, body):
        """Look up the action-specific method and its extensions."""
        # Look up the method
        try:
            if not self.controller:
                meth = getattr(self, action)
            else:
                meth = getattr(self.controller, action)
        except AttributeError:
            if (not self.wsgi_actions or
                    action not in _ROUTES_METHODS + ['action']):
                if self.controller:
                    msg = _("The request method: '%(method)s' with action: "
                            "'%(action)s' is not allowed on this "
                            "resource") % {
                                'method': request.method, 'action': action
                        }
                    raise webob.exc.HTTPMethodNotAllowed(
                        explanation=msg, body_template='${explanation}')
                # Propagate the error
                raise
        else:
            return meth, self.wsgi_extensions.get(action, [])

        if action == 'action':
            action_name = action_peek(body)
        else:
            action_name = action

        # Look up the action method
        return (self.wsgi_actions[action_name],
                self.wsgi_action_extensions.get(action_name, []))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号