#5090: Url patterns are case-sensitive.
-------------------------------------+-------------------------------------
Reporter: Alex Nickolaenkov | Owner: Malcolm
<nickolaenkov@…> | Tredinnick
Type: Uncategorized | Status: closed
Component: HTTP handling | Version: dev
Severity: Normal | Resolution: wontfix
Keywords: url handling | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by MiloLug):
What if just add, say `ipath` and `re_ipath`.
I even have an example of such code in my project:
{{{
import re
from functools import partial
from django.urls.resolvers import RoutePattern, RegexPattern,
_route_to_regex
from django.urls.conf import _path
from django.core.exceptions import ImproperlyConfigured
class IRoutePattern(RoutePattern):
def _compile(self, route):
return re.compile(_route_to_regex(route, self._is_endpoint)[0],
re.IGNORECASE)
class IRegexPattern(RegexPattern):
def _compile(self, regex):
"""Compile and return the given regular expression."""
try:
return re.compile(regex, re.IGNORECASE)
except re.error as e:
raise ImproperlyConfigured(
'"%s" is not a valid regular expression: %s' % (regex, e)
) from e
ipath = partial(_path, Pattern=IRoutePattern)
re_ipath = partial(_path, Pattern=IRegexPattern)
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/5090#comment:7>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/0107018292be96da-8b9caac1-05f3-43d5-9347-701ecd54b2eb-000000%40eu-central-1.amazonses.com.