BUG: Return empty list for empty default tag for vector parameter#6
BUG: Return empty list for empty default tag for vector parameter#6fbudin69500 wants to merge 1 commit into
Conversation
When the default value for a parameter that is a vector is not set or set to nothing, it should be configured as an empty list, not an empty string. If ctk_cli returns an empty string, the parsing of the default value will result in an error.
|
@fbudin69500 Maybe generate a warning and then assign it to empty list? |
|
I feel if their xml does not provide a default for an optional argument, they should at least see a warning. This would preserve backward compatibility and also softly prompt them to fix their xml specs. I personally would like to through an error which would force them to fix their xml specs. Not many python CLIs out there yet. |
|
CC: @jcfr |
|
I wouldn't throw an error. I think it is not wrong to specify an empty default value for vectors as it may very well be what you want (if by default you want to not give any element). Do you see any use-case where an empty list would create a problem? I feel that both in C++ and in Python, it would be valid to have an empty default value for a vector element. For other types of arguments (integer, floats,bolean), I agree that a default value should be required (it might be the case, I have not double-checked). |
|
I agree with what you say for But with scalar types, i foresee usecases in which they would like to delegate the default value selection to the actual code rather than specifying it in the xml spec. Think of So i guess maybe the all inclusive way is to allow them not to specify the default in the xml spec. If it is not specified, within ctk_cli we assume and assign its corresponding variable to None. The CLI code will then have to check for None and override if needed. The only downside the user of the CLI will not know the default value used unless he looks at the CLI code. |
|
I think the most important is to have a consistant behavior with GenerateCLP. @jcfr , what is the behavior of GenerateCLP if no default value is specified? |
|
This is a problem I had as well. IIRC, GenerateCLP gives less arguments to the CLI than my MeVisLab backend in some cases. Maybe this is such a case, i.e. when no default is configured? In MeVisLab, it might be difficult to detect whether the user has "entered something", i.e. when using a widget for coordinates. When no default is given, such a widget would be filled with zeroes, and I would call the CLI with the (0,0,0) vector, for instance. |
|
Hans, Does the patch I submitted break something in MeVisLab? Or would it help in Francois On Tue, May 10, 2016 at 2:49 AM, Hans Meine notifications@github.com
|
|
I don't use the CLP in MeVisLab. I created ctk-cli to contain the code for calling CLIs, not for implementing them. It's nice that it now turns out to be useful for both sides, but the latter I have not done yet with MeVisLab. |
When the default value for a parameter that is a vector is not set
or set to nothing, it should be configured as an empty list, not
an empty string. If ctk_cli returns an empty string, the parsing
of the default value will result in an error.