-
Notifications
You must be signed in to change notification settings - Fork 94
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
Avoid %% escape in xtrigger func args (7.8.x). #3257
Conversation
Test using the built-in
In the function args, On current 7.8.x and master branches (reproduces the bug):
On this branch, validation and run:
|
RE_STR_TMPL = re.compile(r'%\(([\w]+)\)s') | ||
# Extract 'foo' from string templates '%(foo)s', avoiding '%%' escaping | ||
# ('%%(foo)s` is not a string template). | ||
RE_STR_TMPL = re.compile(r'(?<!%)%\(([\w]+)\)s') |
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.
Zero-width negative look behind assertion, innit 😁
You beat me to it! I used an exclusion class (i.e. |
Sorry about that! However, I don't think the exclusion class works because it is not zero width. i.e. it would match |
I think you're right, but because the exclusion isn't part of the capturing group, even if it did match I don't have an issue with the zero width lookaround, but I will confess that I didn't recognize it immediately. I think the lookaround will also permit two of these format strings to be concatenated, which would fail to match using the exclusive character class. |
Maybe we should include a few unit tests covering the cases discussed above so far ☝️ ? 😬 |
Yes, I've left this as a WIP/Draft pending time to think about tests. |
Oh, sorry, didn't look at the checklist. |
Now I'm very glad my fix got scooped by @hjoliver! |
God damn it. Style fail. |
@trwhitcomb - I've added you as a "collaborator" on this repository so I can assign you to review this PR. You should get an invite from GitHub. |
Test failures are related to #3244 - Travis CI hostname issue. |
These changes close #3256
Requirements check-list
CONTRIBUTING.md
and added my name as a Code Contributor.CHANGES.md
.