[Zope3-checkins]
SVN: Zope3/branches/hdima-language-namespace/src/zope/
IHTTPRequest.__setupLocale() => IHTTPRequest.setupLocale()
Dmitry Vasiliev
dima at hlabs.spb.ru
Sun Aug 7 16:28:33 EDT 2005
Log message for revision 37776:
IHTTPRequest.__setupLocale() => IHTTPRequest.setupLocale()
Changed:
U Zope3/branches/hdima-language-namespace/src/zope/app/publisher/browser/__init__.py
U Zope3/branches/hdima-language-namespace/src/zope/publisher/http.py
U Zope3/branches/hdima-language-namespace/src/zope/publisher/interfaces/http.py
U Zope3/branches/hdima-language-namespace/src/zope/publisher/tests/test_browserlanguages.py
-=-
Modified: Zope3/branches/hdima-language-namespace/src/zope/app/publisher/browser/__init__.py
===================================================================
--- Zope3/branches/hdima-language-namespace/src/zope/app/publisher/browser/__init__.py 2005-08-07 18:11:00 UTC (rev 37775)
+++ Zope3/branches/hdima-language-namespace/src/zope/app/publisher/browser/__init__.py 2005-08-07 20:28:33 UTC (rev 37776)
@@ -128,6 +128,7 @@
def setPreferredLanguages(self, languages):
languages_data = self._getLanguagesData()
languages_data["overridden"] = languages
+ self.request.setupLocale()
def getPreferredLanguages(self):
languages_data = self._getLanguagesData()
Modified: Zope3/branches/hdima-language-namespace/src/zope/publisher/http.py
===================================================================
--- Zope3/branches/hdima-language-namespace/src/zope/publisher/http.py 2005-08-07 18:11:00 UTC (rev 37775)
+++ Zope3/branches/hdima-language-namespace/src/zope/publisher/http.py 2005-08-07 20:28:33 UTC (rev 37776)
@@ -43,7 +43,7 @@
# Default Encoding
-ENCODING = 'UTF-8'
+ENCODING = 'utf-8'
class CookieMapper(RequestDataMapper):
_mapname = '_cookies'
@@ -256,9 +256,9 @@
self.__setupPath()
self.__setupURLBase()
self._vh_root = None
- self.__setupLocale()
+ self.setupLocale()
- def __setupLocale(self):
+ def setupLocale(self):
self.response.setCharsetUsingRequest(self)
envadapter = IUserPreferredLanguages(self, None)
if envadapter is None:
@@ -740,7 +740,7 @@
# Exception caused by empty list! This is okay though, since the
# browser just could have sent a '*', which means we can choose
# the encoding, which we do here now.
- charset = 'utf-8'
+ charset = ENCODING
self.setCharset(charset)
def setBody(self, body):
Modified: Zope3/branches/hdima-language-namespace/src/zope/publisher/interfaces/http.py
===================================================================
--- Zope3/branches/hdima-language-namespace/src/zope/publisher/interfaces/http.py 2005-08-07 18:11:00 UTC (rev 37775)
+++ Zope3/branches/hdima-language-namespace/src/zope/publisher/interfaces/http.py 2005-08-07 20:28:33 UTC (rev 37776)
@@ -47,7 +47,7 @@
def getVirtualHostRoot():
"""Returns the object which is the virtual host root for this request
-
+
Return None if setVirtualHostRoot hasn't been called.
"""
@@ -204,7 +204,12 @@
locale = Attribute(
"Return the locale object associated with this request.")
+ def setupLocale():
+ """Setup the locale object based on languages returned by
+ IUserPreferredLanguages adapter.
+ """
+
class IHTTPCredentials(Interface):
# TODO: Eventially this will be a different method
Modified: Zope3/branches/hdima-language-namespace/src/zope/publisher/tests/test_browserlanguages.py
===================================================================
--- Zope3/branches/hdima-language-namespace/src/zope/publisher/tests/test_browserlanguages.py 2005-08-07 18:11:00 UTC (rev 37775)
+++ Zope3/branches/hdima-language-namespace/src/zope/publisher/tests/test_browserlanguages.py 2005-08-07 20:28:33 UTC (rev 37776)
@@ -37,6 +37,9 @@
def __init__(self, languages):
self["HTTP_ACCEPT_LANGUAGE"] = languages
+ def setupLocale(self):
+ pass
+
class BrowserLanguagesTest(unittest.TestCase):
def factory(self, request):
More information about the Zope3-Checkins
mailing list