Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
getAllEntries returns empty string instead of None. #233
I'm using getAllEntries, these values are always ints (port entries). If the entry is empty, an empty string is returned which is fine for most cases but if you then try to convert to an int you get a value error.
This is to be expected because it's a blank string, and not a numeric value in string form. the same also happens for None values.
I think in the cases where there is no value it might be best not to include them in the dictionary instead of blank strings?
I'm not sure that's the right approach. I think
If you're using
If they're standard entries, and the user didn't type anything, then I would expect an empty string - as that's the current value of the entry.
There's a case to say numeric entries should return None if they're empty....
That would be fantastic !
I worked around it, and get value checking without using lots of If lines by doing this.
Which works (almost) very nicely as the defaults are used on error, even if the user enters non-numeric values, it also sorts out empty strings. Only issue is all defaults are used if the previous line fails, which if I'm honest I have no problems with.