EdinburghGenomics / pyclarity-lims

Python interface to the GenoLogics LIMS server via its REST API.
MIT License
11 stars 4 forks source link

UdfConfig presets clear method clears the entire UdfConfig object #23

Closed Rubyj closed 6 years ago

Rubyj commented 6 years ago

Calling the UdfConfig.preset.clear() method seems to clear values from the entire UdfConfig object. Even if I set the preset list manually to a new empty list the object is also cleared...Is this expected?

Rubyj commented 6 years ago

more specifically. All these fields in UdfConfig.presets are cleared

allow_non_preset_values attach_to_name first_preset_is_default_value is_controlled_vocabulary is_deviation is_editable name presets show_in_lablink show_in_tables

tcezard commented 6 years ago

I haven't wrote or used that part of the library so will have to dive a bit into what it is supposed to do

tcezard commented 6 years ago

Ah I see it now. It is this line https://github.com/EdinburghGenomics/pyclarity-lims/blob/66586f02da5660a87a4347e246dd76eac0bb29c4/pyclarity_lims/descriptors.py#L440 Which causes the issue.

Rubyj commented 6 years ago

@tcezard Is this only for python2.7?

Something like this will work to clear a list in python2.7

x = [1, 2, 3] del x[:]

Sorry - on second look you are already doing that. So, do you actually want to clear the rootnode/self?

tcezard commented 6 years ago

I put a PR up to fix this. Thanks for reporting this