account.py 文件源码

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

项目:rucio 作者: rucio01 项目源码 文件源码
def DELETE(self, account):

        """ Delete an account's identity mAPPing.

        HTTP Success:
            200 Created

        HTTP Error:
            400 Bad Reqeust
            401 Unauthorized
            404 Not Found
            500 Internal Error
        :param account: Account identifier.
        """
        json_data = data()
        try:
            parameter = loads(json_data)
        except ValueError:
            raise generate_http_error(400, 'ValueError', 'cannot decode json parameter dictionary')
        try:
            identity = parameter['identity']
            authtype = parameter['authtype']
        except KeyError, e:
            if e.args[0] == 'authtype' or e.args[0] == 'identity':
                raise generate_http_error(400, 'KeyError', '%s not defined' % str(e))
        except TypeError:
            raise generate_http_error(400, 'TypeError', 'body must be a json dictionary')
        try:
            del_account_identity(identity, authtype, account)
        except AccessDenied, e:
            raise generate_http_error(401, 'AccessDenied', e.args[0][0])
        except AccountNotFound, e:
            raise generate_http_error(404, 'AccountNotFound', e.args[0][0])
        except IdentityError, e:
            raise generate_http_error(404, 'IdentityError', e.args[0][0])
        except Exception, e:
            print format_exc()
            raise InternalError(e)

        raise OK()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号