[Zope-Checkins] CVS: Zope3/lib/python/Zope/Publisher/Browser - BrowserLanguages.py:1.5
Barry Warsaw
barry@wooz.org
Tue, 18 Jun 2002 08:46:33 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/Publisher/Browser
In directory cvs.zope.org:/tmp/cvs-serv5524
Modified Files:
BrowserLanguages.py
Log Message:
getPreferredLanguages(): Don't crash if there's no
HTTP_ACCEPT_LANGUAGE in the request. You don't get much useful
information (i.e. none of the explicit msgids are translated) but at
least you don't get a traceback.
FYI: When accessing the page via Python's urllib, there's no
HTTP_ACCEPT_LANGUAGE.
=== Zope3/lib/python/Zope/Publisher/Browser/BrowserLanguages.py 1.4 => 1.5 ===
'''See interface IUserPreferredLanguages'''
langs = []
- for lang in self.request['HTTP_ACCEPT_LANGUAGE'].split(','):
+ for lang in self.request.get('HTTP_ACCEPT_LANGUAGE', '').split(','):
lang = lang.strip()
if lang:
langs.append(lang.split(';')[0])