Skip to content

Commit

Permalink
fix: support another slug pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
Bruno Alla authored and browniebroke committed Jan 18, 2021
1 parent 202a6b3 commit a4ce0cb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions django_codemod/visitors/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class PatternNotSupported(RuntimeError):
".+": "path",
"[-a-zA-Z0-9_]+": "slug",
r"[\w-]+": "slug",
r"[-\w]+": "slug",
"[^/]+": "str",
"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}": "uuid",
}
Expand Down
2 changes: 2 additions & 0 deletions tests/visitors/test_urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ def test_grouped_path(self) -> None:
url(r'^page/(?P<number>\d+)/$', views.page, name='page'),
url(r'^post/(?P<slug>[-a-zA-Z0-9_]+)/$', views.post, name='post'),
url(r'^post/(?P<slug>[\w-]+)/$', views.post, name='post'),
url(r'^post/(?P<slug>[-\w]+)/$', views.post, name='post'),
url(r'^about/(?P<name>[^/]+)/$', views.about, name='about'),
url(r'^uuid/(?P<uuid>{uuid_re})/$', by_uuid),
url(r'^(?P<path>.+)/$', views.default, name='default'),
Expand All @@ -142,6 +143,7 @@ def test_grouped_path(self) -> None:
path('page/<int:number>/', views.page, name='page'),
path('post/<slug:slug>/', views.post, name='post'),
path('post/<slug:slug>/', views.post, name='post'),
path('post/<slug:slug>/', views.post, name='post'),
path('about/<str:name>/', views.about, name='about'),
path('uuid/<uuid:uuid>/', by_uuid),
path('<path:path>/', views.default, name='default'),
Expand Down

0 comments on commit a4ce0cb

Please sign in to comment.