Opened 19 years ago

Closed 19 years ago

Last modified 17 years ago

#54 closed defect (fixed)

pattern in url_dispatch.txt maybe wrong

Reported by: James Zhu Owned by: Jacob
Component: Documentation Version:
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

>>> import re
>>> a = r'^/articles/(?P\d{4})/$'
>>> re.compile( a )
Traceback (most recent call last):
  File "<input>", line 1, in ?
  File "C:\Python24\Lib\sre.py", line 180, in compile
    return _compile(pattern, flags)
  File "C:\Python24\Lib\sre.py", line 227, in _compile
    raise error, v # invalid expression
error: unknown specifier: ?P\d
>>> a = r'^/articles/(?P<year>\d{4})/$'
>>> re.compile( a )
<_sre.SRE_Pattern object at 0x01093350>

Should we add the group name in patterns?

Change History (1)

comment:1 by Adrian Holovaty, 19 years ago

Resolution: fixed
Status: newclosed

Yes, indeed! Good catch. Fixed in [191].

Note: See TracTickets for help on using tickets.
Back to Top