-
Notifications
You must be signed in to change notification settings - Fork 442
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In Django 2, routes defines via urls.path are aggresively escaped when converted into regex. This is a naive fix which unescapes all characters outside capture groups, but in the context of OpenAPI is okay because regular expressions inside paths are not supported anyway. This issue affects django-rest-framework as well, as outlined in encode/django-rest-framework#5672, encode/django-rest-framework#5675.
- Loading branch information
Showing
5 changed files
with
63 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,17 @@ | ||
from django.conf.urls import url | ||
import django | ||
|
||
from . import views | ||
|
||
urlpatterns = [ | ||
url(r'$', views.SnippetList.as_view()), | ||
url(r'^(?P<pk>[0-9]+)/$', views.SnippetDetail.as_view()), | ||
] | ||
if django.VERSION[:2] >= (2, 0): | ||
from django.urls import path | ||
|
||
urlpatterns = [ | ||
path('', views.SnippetList.as_view()), | ||
path('<int:pk>/', views.SnippetDetail.as_view()), | ||
] | ||
else: | ||
from django.conf.urls import url | ||
urlpatterns = [ | ||
url('^$', views.SnippetList.as_view()), | ||
url(r'^(?P<pk>\d+)/$', views.SnippetDetail.as_view()), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters