-
-
Notifications
You must be signed in to change notification settings - Fork 406
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
privileges, url: fix privilege check in .urlban
command family
#2650
Conversation
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.
Nice patch!
I think it would be better to add them to |
Yeah it is now. Before 8.0 released, it was still changeable. Now we have to keep it this way until at least 9.0. What I don't like about making Is there a better way to organize things such that the enum can become Yes I know about |
I really dislike the usage of the wildcard Beside, no ones need |
The change from constants defined at `sopel.privileges` module level to an enum wasn't *entirely* seamless: `sopel.privileges.__all__` no longer contains the list of privilege level names. Credit where credit is due: Exirel reminded me that list comprehensions are a thing that works for this type of case. Co-authored-by: Exirel <[email protected]>
We would have noticed sooner that `.urlban` was broken if it had test coverage. Now it does.
Good point. I knew it was a good idea to keep each module's changes in a separate commit. Very easy to just drop the new attr in |
privileges, url: fix privilege check in `.urlban` command family
Description
This is a possible resolution for #2649.
Maybe there's a better way to do this—maybe it would be better to just use
AccessLevel._member_names_
directly—but suggesting an alternative approach when appropriate is what code review's for, right?The commits are separated out so it'll be easy to bring whatever is useful (especially the new test case) over to a new approach if someone has a better idea.
Checklist
make qa
(runsmake lint
andmake test
)An alternative of my own
Defining these shortcut constants from
sopel.plugin
(below) insopel.privileges
instead could be useful:sopel/sopel/plugin.py
Lines 26 to 34 in 99c4a00
I do wonder if we should in fact make
sopel.privileges.__all__
export the list of privilege names, and keepAccessLevel
as more of an internal thing. It would remove any need for a weird module-level constant (sopel.privileges.names
), and simplify adding the aliases back tosopel.plugin
(to one line:from sopel.privileges import *
).