Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#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 Alex Hill, 8 years ago

Has patch: set

comment:2 by Markus Holtermann, 8 years ago

Severity: NormalRelease blocker
Triage Stage: UnreviewedAccepted

comment:3 by Markus Holtermann <info@…>, 8 years ago

Resolution: fixed
Status: newclosed

In 9711207:

Fixed #26945 -- Ensured that i18n_patterns returns a list

comment:4 by Markus Holtermann <info@…>, 8 years ago

In 4e8ccb32:

[1.10.x] Fixed #26945 -- Ensured that i18n_patterns returns a list

Backport of 971120778a7e7b7ebc2fc48275cca20a87580efe from master

Note: See TracTickets for help on using tickets.
Back to Top