Changeset 2017

Show
Ignore:
Timestamp:
01/08/05 18:13:08 (20 years ago)
Author:
jalet
Message:

Move some functions outside of the CGI to allow their use in other CGI scripts

Location:
pykota/trunk
Files:
1 added
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/cgi-bin/printquota.cgi

    r1871 r2017  
    2424# 
    2525# $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# 
    2629# Revision 1.40  2004/10/23 19:28:18  jalet 
    2730# Small fix to the cgi script to please Freshmeat's fmII URL validator/1.1 
     
    161164from pykota.tool import PyKotaTool, PyKotaToolError 
    162165from pykota.reporter import PyKotaReporterError, openReporter 
     166import pykota.cgifuncs 
    163167 
    164168header = """Content-type: text/html 
     
    203207  </body> 
    204208</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] 
    217209 
    218210class PyKotaReportGUI(PyKotaTool) : 
     
    366358             
    367359if __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()) 
    370362    admin.form = cgi.FieldStorage() 
    371363    admin.guiAction()