-
-
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: quote ListAttribute items when required #1690
Conversation
|
@dgw fixed, no problem. :) |
Apparently there is something wrong with it: tests are failing for 2.7 only. lol, well done Python 2.7, you're officially the worst. |
OK I found the problem, it's from Python 2.7's ConfigParser built-in module:
So, if the line is empty: skip it. On the other hand in Python 3, and I quote the documentation:
My mood right now: (This is a gif by Boulet on Twitter, a French artist that also provides an English version of his blog) |
cb3be11
to
c51c397
Compare
NOW it works. @dgw I waited for the tests this time. |
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.
Little nemesiS here, bit of grammar there, and a technical question just 'cause. 😸
Why it took me so long to actually review this, I can't say. Thought I'd done so already. 😕
@dgw will squash when approved! :) |
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.
Checked the applied review changes, all good to squash!
2dbc47a
to
05c0c07
Compare
Waiting for Travis to do its job after the rebase & squash. 👍 |
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.
Why. Did. I. Miss. These?! 😑
@Exirel Looks good. Squash again and I'll merge before I have any time to look for typos a third time. 😝 |
In a ListAttribute, a value can start with a #, which is then considered as a comment by the Config reader. This is bad news, as channel names usually start with a # (they can start with a & too, which is less common on freenode). To prevent this, what I do is: * quote the item only if necessary * unquote it if it correspond to a very specific pattern `"#<name>"` This way, we can have this ListAttribute: channels = "#sopel" &private Edge case like `"&something"` won't be unquoted, because they don't match the exact pattern! (with applied suggestions from code review) Co-Authored-By: dgw <[email protected]>
9836efb
to
5dd7b8f
Compare
Done! |
In a ListAttribute, a value can start with a #, which is then considered as a comment by the Config reader. This is bad news, as channel names usually start with a # (they can start with a & too, which is less common on freenode).
To prevent this, what I do is:
"#<name>"
This way, we can have this ListAttribute:
Edge case like
"&something"
won't be unquoted, because they don't match the exact pattern!@dgw it replaces your PR #1689 because my first idea wasn't really on point. It would lead to a myriad of edge cases and unforeseen consequences. This one is, I believe, better, and doesn't change how current config are written.