From 05756bbf24ea534214f9afbaa0fe8ffe8c80697e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorenz=20H=C3=BCdepohl?= <dev@stellardeath.org> Date: Fri, 11 Oct 2024 12:49:29 +0200 Subject: [PATCH] Support "MPCDF:ignore_*" attributes in projects --- mpcdf_common.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/mpcdf_common.py b/mpcdf_common.py index 2a46f4e..6fd0fd1 100644 --- a/mpcdf_common.py +++ b/mpcdf_common.py @@ -386,10 +386,22 @@ def get_attribute(api_url, project, package, attribute, with_project=None): def overloaded_project_attribute(api_url, project, attribute): + ignore_attribute = attribute.replace("MPCDF:", "MPCDF:ignore_") + try: - return get_attribute_values(api_url, project, None, attribute) + values = get_attribute_values(api_url, project, None, attribute) except UnsetAttributeException: - return get_attribute_values(api_url, "software", None, attribute) + values = None + + try: + ignored = get_attribute_values(api_url, project, None, ignore_attribute) + except UnsetAttributeException: + ignored = () + + if values is None: + values = get_attribute_values(api_url, "software", None, attribute) + + return list(filter(lambda v: v not in ignored, values)) def overloaded_package_attribute(api_url, project, package, attribute): -- GitLab