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

using setattr() for setting plugin parameters makes plugin development tricky #9

Open
beOn opened this issue Apr 3, 2019 · 0 comments

Comments

@beOn
Copy link
Contributor

beOn commented Apr 3, 2019

I understand the motivations, but I think using setattr to pass params to plugins isn't a good choice. It makes it super easy for plugin developers to wind up with weird exceptions.

Specifically, if you're writing something like the multiprocessing plugin, where parameters get passed on to some delegate object, if you don't make sure your override of setattr checks whether that delegate object exists before checking whether it defines whatever parameter you'd like to pass it, you'll run into exceptions any time you try to set a property of your plugin. Usually, this means your plugin class can't get past init.

A more robust approach would be to have subclasses implement setParam() and getParam() methods, then store params however they like.

@beOn beOn closed this as completed Apr 3, 2019
@beOn beOn reopened this Apr 3, 2019
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

1 participant