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

Make custom checkers easier #35

Closed
ziima opened this issue Sep 14, 2018 · 2 comments
Closed

Make custom checkers easier #35

ziima opened this issue Sep 14, 2018 · 2 comments

Comments

@ziima
Copy link
Collaborator

ziima commented Sep 14, 2018

To create a setting with a custom checker is rather painful process. There are options, but for example to create a setting which allows both - string and list of strings - is not very easy. I can't reuse neither StringSetting, not IterableSetting as I can't change the checker in either of those.

I suggest to use similar approach as is used in Django in form fields' and models fields' validators. Each Setting would have default validators, an option to pass additional validators and possibly other arguments which would be transform into validators.

Also I suggest to reuse Django validators instead of checkers, where possible as it would decrease code duplication.

@pawamoy
Copy link
Owner

pawamoy commented Sep 14, 2018

Yes this is exactly what I wanted to do. I don't like the current system of "checkers" (not even the name). Django validators is the way to go (less friction for new users and already battle-tested). I had looked at it before and they seemed a bit overpowered (with a lot of class inheritance) but I'm sure we can find a way to use them.

@pawamoy
Copy link
Owner

pawamoy commented Sep 25, 2018

Implemented in #36

@pawamoy pawamoy closed this as completed Sep 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants