-
-
Notifications
You must be signed in to change notification settings - Fork 402
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
Disabling url.py module also disables @url decorator #1489
Comments
Thanks for the thorough description of the issue! I saw your message on my PR, and I'm thinking about it since then. I'll see what I can come up with, and I'm sure we'll find a solution. |
While we are at it, the
Here is what's going on:
It's a bit tricky, but it means that URL callback must not be called unless they have a That's some undocumented stuff! |
It looks like it is more complicated than that. The However, the That being said, I would keep these parameters in the See the At the end of the day, the |
To be fair, |
I did a bit of work in #1508 just to start somewhere. Now I just need to know if we should merge as-is, and work on a new PR for the next step, as #1508 is already an improvement and can be documented as-is for plugin maintainers; or if I should continue in this PR in order to fix this issue in one go. |
I just said in #1508, but I'll repeat here: Let's make the new interface one step, and actually try to replace the url module separately. That way, bikeshedding the replacement won't hold up the straightforward addition of those convenience methods. |
Should be fixed by #1510, so removing "Patches Welcome" label. |
The point of adding
@module.url()
to the module API was to simplify the song-and-dance of adding a module's URL patterns to the global list of "callbacks" so thaturl.py
wouldn't process links already handled by a more specific plugin.However, if
url.py
is not loaded, any callable using@url
will simply never run, because these functions are dispatched inurl.py
instead of by Sopel's core:sopel/sopel/modules/url.py
Lines 239 to 245 in 0543f2f
I consider this to be a pretty major bug in the API. The point of having
url_callbacks
is forurl.py
to avoid double-processing links that another module already handles. Module API functionality must not depend on loading any module besidescoretasks
(which cannot be disabled, for obvious reasons).(On a personal note, this also explains why I couldn't get
@url
-decorated callables to trigger on my own Sopel instance when I tried a few years ago. I've hadurl.py
disabled approximately forever.)I think the solution here is to move
url.py
's URL-detection and callback-dispatch logic intocoretasks
, and theexclude
&exclusion_char
settings from the[url]
config section into[core]
. This@rule
:sopel/sopel/modules/url.py
Lines 157 to 158 in 0543f2f
would become just another
@url
decorator.That said, making all modules equal by moving dispatch of
@url
intocoretasks
presents a dilemma: How to determine which callback/pattern is "most appropriate", and avoid having the same URL processed by bothurl.py
and (an)other module(s)? I'm almost positive that this conundrum is the reason why the current implementation was implemented as-is, but I'm also sure it's a solvable problem.Given the lack of immediate ideas (at least on my end), and the fact that this is a fairly major overhaul, I'm assigning this issue to Sopel 7. That's the ideal, but if implementing a solution requires an API change, this will be pushed to Sopel 8 so as to provide advance warning via release notes. (It will also, of course, be pushed off if it simply isn't ready in a reasonable amount of time.)
The text was updated successfully, but these errors were encountered: