root / pykota / trunk / pykota / cgifuncs.py @ 2862

Revision 2622, 1.3 kB (checked in by jerome, 18 years ago)

Added 2006 to the copyright's years.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1# PyKota - Print Quotas for CUPS and LPRng
2#
3# (c) 2003, 2004, 2005, 2006 Jerome Alet <alet@librelogiciel.com>
4# This program is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation; either version 2 of the License, or
7# (at your option) any later version.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program; if not, write to the Free Software
16# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17#
18# $Id$
19#
20#
21
22import os
23
24def getLanguagePreference() :
25    """Returns the preferred language."""
26    languages = os.environ.get("HTTP_ACCEPT_LANGUAGE", "")
27    langs = [l.strip().split(';')[0] for l in languages.split(",")]
28    return "%s_%s" % (langs[0], langs[0].upper())
29   
30def getCharsetPreference() :
31    """Returns the preferred charset."""
32    charsets = os.environ.get("HTTP_ACCEPT_CHARSET", "UTF-8")
33    charsets = [l.strip().split(';')[0] for l in charsets.split(",")]
34    return charsets[0]
Note: See TracBrowser for help on using the browser.