-
-
Notifications
You must be signed in to change notification settings - Fork 288
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Save pre/post-scripts paths with None
instead of ""
on reset
#3620
Conversation
None
instead of ""
on resetNone
instead of ""
on reset
None
instead of ""
on resetNone
instead of ""
on reset
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I don't get why shifting lines on the second commit. But more importantly, I'm pretty sure the new conditions are inverted to what they used to be, so that needs explaining, maybe a mistake? |
I'm not a pythonist, but don't python have automatic boolean coercing for testing the truthiness of types? Like JS and other languages have. If I remember correctly, types like empty str and empty collections are falsy. Like, we could just write: if pre_script:
command = f"sh '{pre_script}' ; {command}" Otherwise, I think your other checks format would be appropriate here too: EDIT: Found the doc for it: https://docs.python.org/3/library/stdtypes.html#truth-value-testing |
You mean the
Ah, that's an honest mistake. Wrote
It does, but the main issue is when dealing with booleans and ints. A setting saved as My wish would be simply dropping comparisons with |
I employed if post_script not in (None, ""):
command = f"{command} ; sh '{post_script}'"
if pre_script not in (None, ""):
command = f"sh '{pre_script}' ; {command}" Also fixed stuff like this (which would crash if the user still had an outdated xml, or just removed the setting themselves). if self.program["pre_script"] ... # old
if self.program.get("pre_script") ... #new But ideally, it would be great to have in the near future a |
Description
So far, whenever resetting a pre/post-script path for a program, the value
""
(empty string) was used. In such cases, the checks below have been useless and the program would always try to append/prependsh ''
(which thankfully didn't do anything):Now, and for consistency, settings are always saved with the value
None
instead to indicate their absence.Type of change