Skip to content

Commit ca5ff06

Browse files
committed
fix: allow new fields to be registered
1 parent 8091912 commit ca5ff06

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

nipype/interfaces/io.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,14 @@ class DataSinkInputSpec(DynamicTraitedSpec, BaseInterfaceInputSpec):
129129
desc='remove dest directory when copying dirs')
130130

131131
def __setattr__(self, key, value):
132-
super(DataSinkInputSpec, self).__setattr__(key, value)
133132
if key not in self.copyable_trait_names():
133+
if not isdefined(value):
134+
super(DataSinkInputSpec, self).__setattr__(key, value)
134135
self._outputs[key] = value
135136
else:
136137
if key in self._outputs:
137138
self._outputs[key] = value
139+
super(DataSinkInputSpec, self).__setattr__(key, value)
138140

139141
class DataSink(IOBase):
140142
""" Generic datasink module to store structured outputs

nipype/interfaces/tests/test_io.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ def test_datasink():
2323
yield assert_equal, ds.inputs._outputs, {}
2424
ds = nio.DataSink(base_directory = 'foo')
2525
yield assert_equal, ds.inputs.base_directory, 'foo'
26+
ds = nio.DataSink(infields=['test'])
27+
yield assert_true, 'test' in ds.inputs.copyable_trait_names()
2628

2729
def test_datasink_substitutions():
2830
indir = mkdtemp(prefix='-Tmp-nipype_ds_subs_in')

0 commit comments

Comments
 (0)