Ticket #12650: 12650-r12947.diff

File 12650-r12947.diff, 4.0 KB (added by Ramiro Morales, 15 years ago)

Patch fixing issue as devised by robhudson plus tests.

  • django/contrib/admin/templates/admin/base.html

    diff --git a/django/contrib/admin/templates/admin/base.html b/django/contrib/admin/templates/admin/base.html
    a b  
    11<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    2 <html xmlns="http://www.w3.org/1999/xhtml" lang="{{ LANGUAGE_CODE }}" xml:lang="{{ LANGUAGE_CODE }}" {% if LANGUAGE_BIDI %}dir="rtl"{% endif %}>
     2<html xmlns="http://www.w3.org/1999/xhtml" lang="{{ LANGUAGE_CODE|default:"en-us" }}" xml:lang="{{ LANGUAGE_CODE|default:"en-us" }}" {% if LANGUAGE_BIDI %}dir="rtl"{% endif %}>
    33<head>
    44<title>{% block title %}{% endblock %}</title>
    55<link rel="stylesheet" type="text/css" href="{% block stylesheet %}{% load adminmedia %}{% admin_media_prefix %}css/base.css{% endblock %}" />
  • django/contrib/databrowse/templates/databrowse/base.html

    diff --git a/django/contrib/databrowse/templates/databrowse/base.html b/django/contrib/databrowse/templates/databrowse/base.html
    a b  
    11<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    2 <html xmlns="http://www.w3.org/1999/xhtml" lang="{{ LANGUAGE_CODE }}" xml:lang="{{ LANGUAGE_CODE }}" {% if LANGUAGE_BIDI %}dir="rtl"{% endif %}>
     2<html xmlns="http://www.w3.org/1999/xhtml" lang="{{ LANGUAGE_CODE|default:"en-us" }}" xml:lang="{{ LANGUAGE_CODE|default:"en-us" }}" {% if LANGUAGE_BIDI %}dir="rtl"{% endif %}>
    33<head>
    44<title>{% block title %}{% endblock %}</title>
    55{% block style %}
  • tests/regressiontests/admin_views/tests.py

    diff --git a/tests/regressiontests/admin_views/tests.py b/tests/regressiontests/admin_views/tests.py
    a b  
    44import datetime
    55from django.core.files import temp as tempfile
    66from django.test import TestCase
     7from django.conf import settings
    78from django.contrib.auth import admin # Register auth models with the admin.
    89from django.contrib.auth.models import User, Permission, UNUSABLE_PASSWORD
    910from django.contrib.contenttypes.models import ContentType
     
    1718from django.utils.html import escape
    1819from django.utils.translation import get_date_formats
    1920from django.utils.encoding import iri_to_uri
     21import django.template.context
    2022
    2123# local test models
    2224from models import Article, BarAccount, CustomArticle, EmptyModel, \
     
    20392041        self.assert_('password' not in adminform.form.errors)
    20402042        self.assertEquals(adminform.form.errors['password2'],
    20412043                          [u"The two password fields didn't match."])
     2044
     2045class ValidXHTMLTests(TestCase):
     2046    fixtures = ['admin-views-users.xml']
     2047    urlbit = 'admin'
     2048
     2049    def setUp(self):
     2050        self._context_processors = None
     2051        self._use_i18n, settings.USE_I18N = settings.USE_I18N, False
     2052        if 'django.core.context_processors.i18n' in settings.TEMPLATE_CONTEXT_PROCESSORS:
     2053            self._context_processors = settings.TEMPLATE_CONTEXT_PROCESSORS
     2054            cp = list(settings.TEMPLATE_CONTEXT_PROCESSORS)
     2055            cp.remove('django.core.context_processors.i18n')
     2056            settings.TEMPLATE_CONTEXT_PROCESSORS = tuple(cp)
     2057            # Force re-evaluation of the contex processor list
     2058            django.template.context._standard_context_processors = None
     2059        self.client.login(username='super', password='secret')
     2060
     2061    def tearDown(self):
     2062        self.client.logout()
     2063        if self._context_processors is not None:
     2064            settings.TEMPLATE_CONTEXT_PROCESSORS = self._context_processors
     2065            # Force re-evaluation of the contex processor list
     2066            django.template.context._standard_context_processors = None
     2067        settings.USE_I18N = self._use_i18n
     2068
     2069    def testLangNamePresent(self):
     2070        response = self.client.get('/test_admin/%s/admin_views/' % self.urlbit)
     2071        self.failIf(' lang=""' in response.content)
     2072        self.failIf(' xml:lang=""' in response.content)
Back to Top