Skip to content

Commit 8c2ae42

Browse files
committed
Allow values to be assigned to a NXlink using the nxlink attribute
1 parent d9f7821 commit 8c2ae42

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/nexusformat/nexus/tree.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5975,6 +5975,16 @@ def __setattr__(self, name, value):
59755975
object.__setattr__(self, name, value)
59765976
elif self.is_external():
59775977
raise NeXusError("Cannot modify an external link")
5978+
elif name == 'nxlink':
5979+
obj = self.nxlink
5980+
if isinstance(obj, NXfield):
5981+
if obj._group is not None:
5982+
obj._group[obj.nxname] = value
5983+
else:
5984+
obj.nxdata = value
5985+
obj.update()
5986+
else:
5987+
raise NeXusError("Cannot modify a linked group")
59785988
else:
59795989
try:
59805990
self.nxlink.setattr(name, value)

0 commit comments

Comments
 (0)