#26945 closed Bug (fixed)
i18n_patterns returns tuple instead of list
Reported by: | Alex Hill | Owned by: | nobody |
---|---|---|---|
Component: | Core (URLs) | Version: | dev |
Severity: | Release blocker | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
In Django 1.10, i18n_patterns()
returns a tuple when USE_I18N is False.
I think it should always return a list, given the docs prescribe the use of lists for urlpatterns:
urlpatterns should be a Python list of url() instances.
As it stands the example given for the usage of i18n_patterns()
wouldn't work with i18n disabled:
from django.conf.urls import include, url from django.conf.urls.i18n import i18n_patterns from about import views as about_views from news import views as news_views from sitemap.views import sitemap urlpatterns = [ url(r'^sitemap\.xml$', sitemap, name='sitemap-xml'), ] news_patterns = ([ url(r'^$', news_views.index, name='index'), url(r'^category/(?P<slug>[\w-]+)/$', news_views.category, name='category'), url(r'^(?P<slug>[\w-]+)/$', news_views.details, name='detail'), ], 'news') urlpatterns += i18n_patterns( url(r'^about/$', about_views.main, name='about'), url(r'^news/', include(news_patterns, namespace='news')), )
Change History (4)
comment:1 by , 8 years ago
Has patch: | set |
---|
comment:2 by , 8 years ago
Severity: | Normal → Release blocker |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:3 by , 8 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
In 9711207: