Skip to content

link.attribute

get_all_attribute(entity, existing_only=True)

Get the attribute of the current entity.

By default, with existing_only set to False, the method returns both inherited and floating method: - Floating Attribute are Attribute that don't exist in the database, but are compatible with the current entity. The object is generated, with a value set to None of to the Definition's default, and must be saved to be made persistent. - Inherited Attribute are Attribute that don't exists for the current entity, but are inherited from an upper entity. If saved, (and optionally modified), the Attribute would become persistent for the current entity.

Parameters:

Name Type Description Default
entity Union[Data, Project, Item, Document, Version, Group]

Union[Project, Item, Document, Version, Group]: Any BipObject supporting attribute.

required
existing_only bool

bool: If True, no floating nor inherited Attribute is returned. If False, they are returned. (Default value = False)

True

Returns:

Name Type Description
list

Collection of Attribute, for each Definition compatible with the current entity.

Source code in client/bip/link/attribute.py
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
def get_all_attribute(
    entity: Union[Data, Project, Item, Document, Version, Group],
    existing_only: bool = True,
):
    """Get the attribute of the current entity.

    By default, with `existing_only` set to False, the method returns both inherited and floating method:
    - **Floating Attribute** are Attribute that don't exist in the database, but are compatible with the current entity.
    The object is generated, with a value set to None of to the Definition's default, and must be saved to be made persistent.
    - **Inherited Attribute** are Attribute that don't exists for the current entity, but are inherited from an upper entity.
    If saved, (and optionally modified), the Attribute would become persistent for the current entity.

    Args:
      entity: Union[Project, Item, Document, Version, Group]: Any BipObject supporting attribute.
      existing_only: bool: If True, no floating nor inherited Attribute is returned. If False, they are returned. (Default value = False)

    Returns:
        list: Collection of Attribute, for each Definition compatible with the current entity.

    """
    return Attribute.get_all(entity, existing_only)

get_attribute(definition, entity, existing_only=True)

Get the attribute of the current entity from a given Definition.

By default, with existing_only set to False, the method returns both inherited and floating method: - Floating Attribute are Attribute that don't exist in the database, but are compatible with the current entity. The object is generated, with a value set to None of to the Definition's default, and must be saved to be made persistent. - Inherited Attribute are Attribute that don't exists for the current entity, but are inherited from an upper entity. If saved, (and optionally modified), the Attribute would become persistent for the current entity.

Parameters:

Name Type Description Default
entity Union[Data, Project, Item, Document, Version, Group]

Union[Project, Item, Document, Version, Group]: Any BipObject supporting attribute.

required
definition Definition

Union[str, Definition]: Definition object or slug.

required
existing_only bool

bool: If True, no floating nor inherited Attribute is returned. If False, they are returned. (Default value = False)

True

Raises:

Type Description
ValueError

The Definition is not compatible with the Project.

Returns:

Name Type Description
Attribute

Matching Attribute.

Source code in client/bip/link/attribute.py
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
def get_attribute(
    definition: Definition,
    entity: Union[Data, Project, Item, Document, Version, Group],
    existing_only: bool = True,
):
    """Get the attribute of the current entity from a given Definition.

    By default, with `existing_only` set to False, the method returns both inherited and floating method:
    - **Floating Attribute** are Attribute that don't exist in the database, but are compatible with the current entity.
    The object is generated, with a value set to None of to the Definition's default, and must be saved to be made persistent.
    - **Inherited Attribute** are Attribute that don't exists for the current entity, but are inherited from an upper entity.
    If saved, (and optionally modified), the Attribute would become persistent for the current entity.

    Args:
      entity: Union[Project, Item, Document, Version, Group]: Any BipObject supporting attribute.
      definition: Union[str, Definition]: Definition object or slug.
      existing_only: bool: If True, no floating nor inherited Attribute is returned. If False, they are returned. (Default value = False)

    Raises:
        ValueError: The Definition is not compatible with the Project.

    Returns:
        Attribute: Matching Attribute.

    """
    return Attribute.get(definition, entity, existing_only)