Call get_setting with setting.name#4000
Conversation
and report if someone is calling with non-str argument
| value is present | ||
| """ | ||
| if not isinstance(setting_name, str): | ||
| import inspect |
There was a problem hiding this comment.
Can the import statement be shifted to the header?
There was a problem hiding this comment.
Moved.
I wasn't sure if you wanted to keep this sort of workaround, so I kept everything close for easier deletion 🙂
joemull
left a comment
There was a problem hiding this comment.
Thanks gamboz--it is helpful to have the warning for sure. We can remove it when / if we put in Python type annotations, or if we add unit tests to the functions that call get_setting, with assertions like Mock.assertCalledWith.
If we want to make it clear it is temporary, maybe we could add a comment about that fact?
done |
Sometimes the function
utils.settings_handler.get_setting()is called with a wrong argument.The function expects a string as second argument (
setting_name), but here and there it is called with acore.Settingobject instead. I think that everything works fine anyway becausestr(Setting)isSetting.name, but I thought I should mention 🙂Here I fix a couple of calls, and I add (temporary) code to report if someone is calling with non-str argument.