Code review comment for lp:~gary/zc.buildout/python-support-1-cleanup

Revision history for this message
Gary Poster (gary) wrote :

Thank you!

I didn't remove the backslash--I switched to using re.escape (for non-Windows). The backslash I removed was escaping the path separator.

For Windows, then, the result will be this.

[^'" \t\n\r]+[\\/]_[Tt][Ee][Ss][Tt]_[\\/]([^"' \t\n\r]+)

IOW, the path separator might be a backslash (Windows path) or a forward slash (typically when it is a URI).

For everything else (if we assume that everything else uses a forward slash for path separators), it will *continue* to be the following, at least effectively (forward slashes actually don't need to be escaped, IIRC, so re.escape won't do anything, and the backslashes didn't do anything before).

[^'" \t\n\r]+/_[Tt][Ee][Ss][Tt]_/([^"' \t\n\r]+)

Actually, now that I think of it, a better change would be this:

sep = os.path.sep
if sep != "/":
    sep = r'[%s/]' % re.escape(sep) # May be a path or a URI\
...
and then the compilation

« Back to merge proposal