mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
[1.11.x] Fixed #28204 -- Fixed MultipleObjectMixin.paginate_queryset() crash on Python 2 if InvalidPage message contains non-ASCII.
This commit is contained in:
@@ -5,6 +5,7 @@ import datetime
|
||||
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
from django.test import TestCase, override_settings
|
||||
from django.utils import translation
|
||||
from django.utils.encoding import force_str
|
||||
from django.views.generic.base import View
|
||||
|
||||
@@ -103,6 +104,13 @@ class ListViewTests(TestCase):
|
||||
res = self.client.get('/list/authors/paginated/42/')
|
||||
self.assertEqual(res.status_code, 404)
|
||||
|
||||
def test_paginated_page_out_of_range_non_ascii_message(self):
|
||||
msg = 'Ung\xfcltige Seite (42): Diese Seite enth\xe4lt keine Ergebnisse'
|
||||
with translation.override('de'):
|
||||
res = self.client.get('/list/authors/paginated/42/')
|
||||
self.assertEqual(res.status_code, 404)
|
||||
self.assertEqual(res.context['exception'], msg)
|
||||
|
||||
def test_paginated_invalid_page(self):
|
||||
self._make_authors(100)
|
||||
res = self.client.get('/list/authors/paginated/?page=frog')
|
||||
|
||||
Reference in New Issue
Block a user