Path expression segments starting with digits #134

Closed
davisagli opened this Issue Nov 30, 2012 · 6 comments

Comments

Projects
None yet
2 participants
Contributor

davisagli commented Nov 30, 2012

z3c.pt uses this regexp to validate path expressions:

    path_regex = re.compile(
        r'^(?:(nocall|not):\s*)*((?:[A-Za-z_][A-Za-z0-9_:]*)' +
        r'(?:/[?A-Za-z_@\-+][?A-Za-z0-9_@\-\.+/:]*)*)$')

This means that a segment of the path cannot start with a digit. That was supported in the reference implementation. (I have a template called 40years.pt and used to be able to use its macros, but cannot with chameleon.)

malthe was assigned Nov 30, 2012

Owner

malthe commented Nov 30, 2012

Interesting, because that regex comes from zope.tales.

Contributor

davisagli commented Nov 30, 2012

Really? I don't see it there.

Owner

malthe commented Nov 30, 2012

Hmmm... maybe not, hehe. But did I write that long regex? Time flies, I guess.

Contributor

davisagli commented Dec 1, 2012

I committed a fix (r128467). What's the best way to write a test for it?

Owner

malthe commented Dec 5, 2012

For a minute there, I thought: hey, that's an SVN revision..

The tests in z3c.pt have always been against regressions and somewhat ad-hoc, so I have just adapted an existing test to whatever situation came up.

But in the case of regular expressions such as this one, I think a doctest in the class is great, and straight-forward to add.

Owner

malthe commented Dec 5, 2016

Seems this was already fixed years ago so we can close the issue here.

malthe closed this Dec 5, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment