Ticket #17566: 17566-2.diff

File 17566-2.diff, 3.1 KB (added by Claude Paroz, 12 years ago)

Patch for master with tests

  • django/core/urlresolvers.py

    diff --git a/django/core/urlresolvers.py b/django/core/urlresolvers.py
    index b83f2f5..f534293 100644
    a b class RegexURLResolver(LocaleRegexProvider):  
    246246
    247247    def __repr__(self):
    248248        return smart_str('<%s %s (%s:%s) %s>' % (
    249             self.__class__.__name__, self.urlconf_name, self.app_name,
     249            self.__class__.__name__, force_text(self.urlconf_name), self.app_name,
    250250            self.namespace, self.regex.pattern))
    251251
    252252    def _populate(self):
  • tests/regressiontests/admin_views/admin.py

    diff --git a/tests/regressiontests/admin_views/admin.py b/tests/regressiontests/admin_views/admin.py
    index 293ddfe..379a8ed 100644
    a b from .models import (Article, Chapter, Account, Media, Child, Parent, Picture,  
    2727    Album, Question, Answer, ComplexSortedPerson, PrePopulatedPostLargeSlug,
    2828    AdminOrderedField, AdminOrderedModelMethod, AdminOrderedAdminMethod,
    2929    AdminOrderedCallable, Report, Color2, UnorderedObject, MainPrepopulated,
    30     RelatedPrepopulated, UndeletableObject)
     30    RelatedPrepopulated, UndeletableObject, UnicodeModel)
    3131
    3232
    3333def callable_year(dt_value):
    site.register(Report, ReportAdmin)  
    622622site.register(MainPrepopulated, MainPrepopulatedAdmin)
    623623site.register(UnorderedObject, UnorderedObjectAdmin)
    624624site.register(UndeletableObject, UndeletableObjectAdmin)
     625site.register(UnicodeModel)
    625626
    626627# We intentionally register Promo and ChapterXtra1 but not Chapter nor ChapterXtra2.
    627628# That way we cover all four cases:
  • tests/regressiontests/admin_views/models.py

    diff --git a/tests/regressiontests/admin_views/models.py b/tests/regressiontests/admin_views/models.py
    index 0d5e327..8775822 100644
    a b class UndeletableObject(models.Model):  
    649649    Refs #10057.
    650650    """
    651651    name = models.CharField(max_length=255)
     652
     653
     654@python_2_unicode_compatible
     655class UnicodeModel(models.Model):
     656    name = models.CharField(max_length=50, verbose_name='¿Name?')
     657    class Meta:
     658        verbose_name = '¿Chapter?'
     659        app_label = 'Продавница'
     660
     661    def __str__(self):
     662        return self.name
  • tests/regressiontests/admin_views/tests.py

    diff --git a/tests/regressiontests/admin_views/tests.py b/tests/regressiontests/admin_views/tests.py
    index 679e3a0..08a1235 100644
    a b class AdminViewUnicodeTest(TestCase):  
    16371637        response = self.client.post('/test_admin/admin/admin_views/book/1/delete/', delete_dict)
    16381638        self.assertRedirects(response, '/test_admin/admin/admin_views/book/')
    16391639
     1640    @override_settings(DEBUG=True)
     1641    def test_unicode_app_label(self):
     1642        """
     1643        Test the technical_404_response debug view can be generated with
     1644        unicode content (#17566)
     1645        """
     1646        response = self.client.get('/test_admin/admin/book/notexist/')
     1647        self.assertEqual(response.status_code, 404)
     1648
    16401649
    16411650@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
    16421651class AdminViewListEditable(TestCase):
Back to Top