Changeset 2017
- Timestamp:
- 01/08/05 18:13:08 (20 years ago)
- Location:
- pykota/trunk
- Files:
-
- 1 added
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/cgi-bin/printquota.cgi
r1871 r2017 24 24 # 25 25 # $Log$ 26 # Revision 1.41 2005/01/08 17:13:08 jalet 27 # Move some functions outside of the CGI to allow their use in other CGI scripts 28 # 26 29 # Revision 1.40 2004/10/23 19:28:18 jalet 27 30 # Small fix to the cgi script to please Freshmeat's fmII URL validator/1.1 … … 161 164 from pykota.tool import PyKotaTool, PyKotaToolError 162 165 from pykota.reporter import PyKotaReporterError, openReporter 166 import pykota.cgifuncs 163 167 164 168 header = """Content-type: text/html … … 203 207 </body> 204 208 </html>""" 205 206 def getLanguagePreference() :207 """Returns the preferred language."""208 languages = os.environ.get("HTTP_ACCEPT_LANGUAGE", "")209 langs = [l.strip().split(';')[0] for l in languages.split(",")]210 return "%s_%s" % (langs[0], langs[0].upper())211 212 def getCharsetPreference() :213 """Returns the preferred charset."""214 charsets = os.environ.get("HTTP_ACCEPT_CHARSET", "UTF-8")215 charsets = [l.strip().split(';')[0] for l in charsets.split(",")]216 return charsets[0]217 209 218 210 class PyKotaReportGUI(PyKotaTool) : … … 366 358 367 359 if __name__ == "__main__" : 368 os.environ["LC_ALL"] = getLanguagePreference()369 admin = PyKotaReportGUI(lang=os.environ["LC_ALL"], charset= getCharsetPreference())360 os.environ["LC_ALL"] = cgifuncs.getLanguagePreference() 361 admin = PyKotaReportGUI(lang=os.environ["LC_ALL"], charset=cgifuncs.getCharsetPreference()) 370 362 admin.form = cgi.FieldStorage() 371 363 admin.guiAction()