aiida-core icon indicating copy to clipboard operation
aiida-core copied to clipboard

issue#6393 Fixed User unfriendly behavior of attributes.all when stored

Open Karanveer266 opened this issue 9 months ago • 0 comments

Summary of Changes

  • Fixed Persistence Issue:
    Resolved an issue where modifications to the attribute dictionary returned by .all did not persist correctly for stored nodes.

  • New Dictionary Wrapper - _AttributesDict:
    Introduced a custom dictionary wrapper that dynamically verifies a node’s is_stored status. If modifications are attempted on a stored node, a ModificationNotAllowed error is raised to prevent unintended changes.

  • New get_dict() Method:
    Implemented a method that returns a deep copy of the node’s attributes, ensuring users must utilize proper setter methods (set(), etc.) for modifications instead of modifying attributes directly.

  • Enhanced Documentation & Warnings:
    Updated documentation and warning messages on the .all property to guide users toward the correct API usage, reducing misuse and confusion.

  • Backward Compatibility Maintained:
    Ensured compatibility with existing implementations while deprecating direct modifications through .all, providing a smooth transition for users.

Closes #6393

Karanveer266 avatar Mar 31 '25 11:03 Karanveer266