Closed
Description
Issue Summary
I think I found a regression. After #223, templates with a dash "-"
in the path are no longer resolved.
Steps to Reproduce
- Add a pattern with a dash, for example,
patterns/components/quote-block/quote-block.html
- Navigate to
http://localhost:8000/pattern-library/
- An error is shown:
Reverse for 'display_pattern' with arguments '('patterns/components/quote-block/quote-block.html',)' not found. 1 pattern(s) tried: ['\\-/pattern\\-library/pattern/(?P<pattern_template_name>[\\w./-\\\\]+.html)$']
In version 1.0.0 it works just fine.
Technical details
In this snippet, I prove that the previous and current regexp does not behave the same with respect to dashes.
import re
template = "pattern/my-component.html"
previous = r"^pattern/(?P<pattern_template_name>[\w./-]+.html)$"
current = r"^pattern/(?P<pattern_template_name>[\w./-\\]+.html)$"
print("1.0.0", re.match(previous, template))
print("1.0.1", re.match(current, template))
$ python poc.py
1.0.0 <re.Match object; span=(0, 25), match='pattern/my-component.html'>
1.0.1 None
Versions:
- Python 3.8.10
- Django 3.2.20
PS: Thank you for this awesome library.
Metadata
Metadata
Assignees
Labels
No labels