[Zope3-checkins] CVS: Zope3/src/zope/publisher/tests - test_http.py:1.10
Marius Gedminas
mgedmin@codeworks.lt
Fri, 11 Apr 2003 08:38:01 -0400
Update of /cvs-repository/Zope3/src/zope/publisher/tests
In directory cvs.zope.org:/tmp/cvs-serv23284/src/zope/publisher/tests
Modified Files:
test_http.py
Log Message:
Fixed a bug with HTTP_ACCEPT_LANGUAGE in HTTPRequest (see the test for more
info).
=== Zope3/src/zope/publisher/tests/test_http.py 1.9 => 1.10 ===
--- Zope3/src/zope/publisher/tests/test_http.py:1.9 Fri Apr 11 06:01:23 2003
+++ Zope3/src/zope/publisher/tests/test_http.py Fri Apr 11 08:38:00 2003
@@ -139,6 +139,23 @@
eq(locale.id.country, None)
eq(locale.id.variant, None)
+ # If the first language is not available we should try others
+ req = self._createRequest({'HTTP_ACCEPT_LANGUAGE': 'xx,en;q=0.5'})
+ locale = req.locale
+ unless(ILocale.isImplementedBy(locale))
+ eq(locale.id.language, 'en')
+ eq(locale.id.country, None)
+ eq(locale.id.variant, None)
+
+ # Regression test: there was a bug where country and variant were
+ # not reset
+ req = self._createRequest({'HTTP_ACCEPT_LANGUAGE': 'xx-YY,en;q=0.5'})
+ locale = req.locale
+ unless(ILocale.isImplementedBy(locale))
+ eq(locale.id.language, 'en')
+ eq(locale.id.country, None)
+ eq(locale.id.variant, None)
+
def testCookies(self):
cookies = {
'HTTP_COOKIE': 'foo=bar; spam="eggs", this="Should be accepted"'