Skip to content
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

Replace fillParams #159

Open
bsanders opened this issue Apr 27, 2017 · 0 comments
Open

Replace fillParams #159

bsanders opened this issue Apr 27, 2017 · 0 comments
Assignees

Comments

@bsanders
Copy link
Contributor

fillParams() as a concept is good but has some issues. It has to be explicitly called, it has some weird typing issues, and at the end, you still have to do substantial amounts of error checking.

The concept could be extended

  1. Provide a new library that is a series of validation functions (isBool(), inSeq(), isAbove(), etc) in pylib
  2. Write a dictionary schema that describes desired variables:
  • expected type,
  • a transform on the data,
  • a validation function using (1) (or user-specified...) with args,
  • a default value,
  • perhaps a relationship to other values (eg, var1 also requires var2),
  • maybe an error message
  1. Add a function to __init__() of the Command class to look for and process the data structure from (2) in a given Command subclass and produce error messages before command's run() is ever called.
  2. Place the resultant parameters in a dictionary member variable, something like self.params.

If it all works, consider how to handle deprecation of fillParams (which can exist in Pallets).

@bsanders bsanders self-assigned this Apr 27, 2017
@bsanders bsanders added the ready label Jun 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant