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

Revision 3133, 1.4 kB (checked in by jerome, 17 years ago)

Changed copyright years.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
RevLine 
[2017]1# PyKota - Print Quotas for CUPS and LPRng
2#
[3133]3# (c) 2003, 2004, 2005, 2006, 2007 Jerome Alet <alet@librelogiciel.com>
[2017]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
[2302]16# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
[2017]17#
18# $Id$
19#
20#
21
[3055]22import sys
[2017]23import os
24
25def getLanguagePreference() :
26    """Returns the preferred language."""
27    languages = os.environ.get("HTTP_ACCEPT_LANGUAGE", "")
28    langs = [l.strip().split(';')[0] for l in languages.split(",")]
[3120]29    #sys.stderr.write("Languages preferences : %s\n" % langs)
[3055]30    return langs[0].replace("-", "_")
[2017]31   
32def getCharsetPreference() :
33    """Returns the preferred charset."""
34    charsets = os.environ.get("HTTP_ACCEPT_CHARSET", "UTF-8")
35    charsets = [l.strip().split(';')[0] for l in charsets.split(",")]
[3120]36    #sys.stderr.write("Charsets preferences : %s\n" % charsets)
[2017]37    return charsets[0]
Note: See TracBrowser for help on using the browser.