def get(self, scope, name): """ List all parents of a data identifier. .. :quickref: Parents; List parents of DID. :resheader Content-Type: application/x-json-stream :param scope: The scope of the data identifier. :param name: The name of the data identifier. :status 200: DID found :status 401: Invalid Auth Token :status 404: DID not found :status 500: Database Exception :returns: A list of dictionary containing all dataset information. """ try: data = "" for dataset in list_parent_dids(scope=scope, name=name): data += render_json(**dataset) + "\n" return Response(data, content_type="application/x-json-stream") except DataIdentifierNotFound as error: return generate_http_error_flask(404, 'DataIdentifierNotFound', error.args[0]) except RucioException as error: return generate_http_error_flask(500, error.__class__.__name__, error.args[0]) except Exception as error: print format_exc() return error, 500
def GET(self, scope, name): """ List all parents of a data identifier. HTTP Success: 200 OK HTTP Error: 401 Unauthorized 406 Not Acceptable 500 InternalError :returns: A list of dictionary containing all dataset information. """ header('Content-Type', 'application/x-json-stream') try: for dataset in list_parent_dids(scope=scope, name=name, vo=ctx.env.get('vo')): yield render_json(**dataset) + "\n" except DataIdentifierNotFound as error: raise generate_http_error(404, 'DataIdentifierNotFound', error.args[0]) except RucioException as error: raise generate_http_error(500, error.__class__.__name__, error.args[0]) except Exception as error: print(format_exc()) raise InternalError(error)
def GET(self, scope, name): """ List all parents of a data identifier. HTTP Success: 200 OK HTTP Error: 401 Unauthorized 500 InternalError :returns: A list of dictionary containing all dataset information. """ header('Content-Type', 'application/x-json-stream') try: for dataset in list_parent_dids(scope=scope, name=name): yield render_json(**dataset) + "\n" except DataIdentifierNotFound, error: raise generate_http_error(404, 'DataIdentifierNotFound', error.args[0][0])
def generate(vo): for dataset in list_parent_dids(scope=scope, name=name, vo=vo): yield render_json(**dataset) + "\n"