Project

General

Profile

Task #2380

Story #2045: Get the DataONE CLI ready for public release

CLI sliently ignores invalid boolean values

Added by Andrew Pippin almost 13 years ago. Updated over 12 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Andrew Pippin
Category:
d1_client_cli
Start date:
2012-02-23
Due date:
% Done:

100%

Milestone:
CCI-1.0.0
Product Version:
*
Story Points:
Sprint:

Description

It is possible to set the variable "verbose" to a value of "@fred@". No error is thrown and the value remains unchanged.

The CLI should report invalid values, and allow for case insensitive boolean values ("@true@", "@True@", "@tRuE@" should all succeed).

History

#1 Updated by Andrew Pippin almost 13 years ago

  • Category set to d1_client_cli
  • Assignee set to Andrew Pippin

Updated Assinged_To and Category.

#2 Updated by Matthew Jones almost 13 years ago

  • Tracker changed from Task to Bug
  • Target version set to Sprint-2012.07-Block.1.4
  • Parent task set to #2045

#3 Updated by Roger Dahl almost 13 years ago

This is caused by a design decision that might not be a good one. The issue is that in order to easily support session variables that are unset (None), boolean, integers or strings, I implemented those as native Python variables and parse them as such. It makes things very clear in the code, but it causes some unexpected results, such as being able to have "fred" a valid value for True, simply because the string "fred" evaluates to True in Python.

So, a value can be set to False by passing in values that evaluate to False in Python, such as "0" and False. It can be set to True with "1", and "fred". It can be set to None by passing "None" (for which the clear command is a shortcut).

#4 Updated by Andrew Pippin over 12 years ago

  Roger is correct. "fred" is a valid value. At first glance, the result is unexpected, but it shouldn't have been.

  A possible solution would be to have a "validator" hook for each session variable. This would also help with #2377 "Verify that the object format is valid in CLI".

#5 Updated by Andrew Pippin over 12 years ago

  • Status changed from New to In Progress

Valid boolean values are:
    TRUE: ('true', 'True', 't', 'T', 1, 'yes', 'Yes' )
    FALSE: ('false', 'False', 'f', 'F', 0, 'no', 'No' )

#6 Updated by Andrew Pippin over 12 years ago

  • % Done changed from 0 to 100
  • Status changed from In Progress to Closed

SVN commit 7246.

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 14.8 MB)