Sessionhandling
Michael Ströder
michael at stroeder.com
Tue Sep 24 05:47:55 EDT 2002
Lutz Schroeer wrote:
> langpref = os.environ['HTTP_ACCEPT_LANGUAGE']
> firstpref = 'en-ie'
> try:
> langs = string.split(langpref, ',')
> firstpref = langs[0]
> secondpref = langs[1]
> thirdpref = langs[2]
> except:
> pass
One might think about a more complete solution handling the weight:
http://stroeder.com/pylib/PyWebLib/pydoc/pyweblib.helper.html#AcceptHeaderDict
Most users do *not* configure their browsers anyway. Therefore it's
almost useless to use HTTP_ACCEPT_LANGUAGE or similar env vars.
Ciao, Michael.
More information about the Python-list
mailing list