-
-
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
config: split ListAttribute values on newlines #1628
Conversation
Vaguely remembered noticing that So, 🎉 for nixing that one last mismatched test framework. 😀 |
4cae19a
to
3bbdd58
Compare
Adds a setting in `core` called `commands_on_connect` based on the updated `ListAttribute` from sopel-irc#1460. This setting stores a comma separated list of raw IRC commands (`\`-escaped commas in commands) to execute upon successful connection to the server. As @dgw put it, "Think ZNC's perform module, but without the ability to add/remove/rearrange lines from an IRC query" in sopel-irc#1455. The commands in the `commands_on_connect` list are executed at the end of the `startup` procedure. They can also be called by a bot admin with the `.execute` command. Note: two `TODO`s were added to adjust docstrings and docs once sopel-irc#1628 is accepted, since it will change the `ListAttribute` delimiter from commas to newlines. Closes sopel-irc#1455
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.
It's long overdue that I looked at this. First order of business is to replace all "breaklines" with "newlines", because that's the word in English. (We could also use "line breaks", but why use lot word when few word do trick?) This included retitling the PR, and should also be reflected in the commit log when you update things.
Documentation-wise, I'm suggesting that the example ListAttribute
be named in the plural ("cheeses"), along with all the potential whitespace changes that requires. This includes matching changes to the tests, for consistency.
Also expect the usual small tweaks to grammar and formatting. 😁
The actual logic change here is tiny, and doesn't need much attention; you'll note that all of my suggestions apply to documentation or tests, because those make up the bulk of this PR.
58b2ea7
to
b9c862a
Compare
In Sopel 6.x and prior version, multi-line values would be split by commas: option = one, two, three and a half, four would give that: ['one', 'two', 'three\nand a half', 'four'] Also, it isn't possible to have a comma inside a value. However, a fellow Sopelunker, in sopel-irc#1460, added an escape mechanism. It was a good idea that didn't account for what Python's ConfigParser could do for us. Indeed, it accepts, as a built-in behavior, to declare an option on multiple lines. Getting the value would then returns a string, strip from extra spaces, with values separated by newlines. Therefore, all I had to do here was to: * detect if there was a newline character in the value * if so, split by newlines * otherwise keep using the comma-separated approach * remove (sadly) the usage of escape character * add some tests * improve docstrings here and there (they were outdated) * make sure we properly serialize back the values and voilà!
Co-Authored-By: dgw <[email protected]>
b9c862a
to
522d400
Compare
So, I had to rebase from master because there was several differences in requirements and in documentations needed... and that messed up the commit history in Github. Talking about documentation, I'll now update it! |
@dgw done! |
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.
Only a couple comments this time around.
Note to self: Remove #1460 from changelog/milestone when merging this for 7.0, as this PR reverts it. |
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.
I think that's everything. Let's 🚢 it! 🚀
Adds a setting in `core` called `commands_on_connect` based on the updated `ListAttribute` from sopel-irc#1460. This setting stores a comma separated list of raw IRC commands (`\`-escaped commas in commands) to execute upon successful connection to the server. As @dgw put it, "Think ZNC's perform module, but without the ability to add/remove/rearrange lines from an IRC query" in sopel-irc#1455. The commands in the `commands_on_connect` list are executed at the end of the `startup` procedure. They can also be called by a bot admin with the `.execute` command. Note: two `TODO`s were added to adjust docstrings and docs once sopel-irc#1628 is accepted, since it will change the `ListAttribute` delimiter from commas to newlines. Closes sopel-irc#1455
Adds a setting in `core` called `commands_on_connect` based on the updated `ListAttribute` from sopel-irc#1460. This setting stores a comma separated list of raw IRC commands (`\`-escaped commas in commands) to execute upon successful connection to the server. As @dgw put it, "Think ZNC's perform module, but without the ability to add/remove/rearrange lines from an IRC query" in sopel-irc#1455. The commands in the `commands_on_connect` list are executed at the end of the `startup` procedure. They can also be called by a bot admin with the `.execute` command. Note: two `TODO`s were added to adjust docstrings and docs once sopel-irc#1628 is accepted, since it will change the `ListAttribute` delimiter from commas to newlines. Closes sopel-irc#1455
See the description of #1626 for more information.
Note: I had to upgrade the
test_config.py
file to use py.test instead of unittest. We should be fine with that.