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
Add whitelist feature to zero plugin #1641
Conversation
Awesome! This looks like it's on the right track. Would you mind adding some documentation on how the option works to the documentation for the zero plugin? It would also be very satisfying to have a few tests in the Finally, it looks like flake8 has a few style suggestions. |
# These fields should be preserved | ||
if 'id' in self.patterns: del self.patterns['id'] | ||
if 'path' in self.patterns: del self.patterns['path'] | ||
if 'album_id' in self.patterns: del self.patterns['album_id'] |
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.
May I recommend a little loop?
for key in ('id', 'path', 'album_id'):
if key in self.patterns:
del self.patterns[key]
Also: It would be awesome to avoid duplicating code between the two modes. Can you please factor out the shared logic to a helper function? |
Thanks for advices, I'm working on it 👍. |
I edited code as you suggested and added some lines to documentation. I hope it'll be fine. |
@@ -41,26 +41,50 @@ def __init__(self): | |||
|
|||
self.config.add({ | |||
'fields': [], | |||
'update_database': False, | |||
'keep_fields': [], | |||
'update_database': False |
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.
Tiny style issue: please add a trailing comma, which helps with maintainability.
Looking great! I have a few minor suggestions, but afterward, this should be ready to merge. ✨ Thank you for your effort on this! |
Done 👍. |
When will this be merged? |
As soon as I have a moment. Thanks for your patience, @flok3r. |
Add whitelist feature to zero plugin
The old version would trigger the warning twice.
Thank you again, @adkow! This is all merged up. ✨ |
Hi, I added new behavior to
zero
plugin as requested in #1621.It works as expected and with no errors (for me 😄).
Now,
zero
has new optionkeep_fields
which contains fields that user want to preserve. Everything else is cleared.