Django

Code

Ticket #54 (closed: fixed)

Opened 3 years ago

Last modified 1 year ago

pattern in url_dispatch.txt maybe wrong

Reported by: james Assigned to: jacob
Milestone: Component: Documentation
Version: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: 0 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

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?

Attachments

Change History

07/18/05 21:22:24 changed by adrian

  • status changed from new to closed.
  • resolution set to fixed.

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


Add/Change #54 (pattern in url_dispatch.txt maybe wrong)




Change Properties
Action