Changeset 1172 for pykota

Show
Ignore:
Timestamp:
10/25/03 00:06:43 (21 years ago)
Author:
jalet
Message:

Initial support for browser's language preference added.

Location:
pykota/trunk
Files:
3 modified

Legend:

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

    r1162 r1172  
    2323# 
    2424# $Log$ 
     25# Revision 1.15  2003/10/24 22:06:42  jalet 
     26# Initial support for browser's language preference added. 
     27# 
    2528# Revision 1.14  2003/10/10 19:48:07  jalet 
    2629# Now displays version number 
     
    111114</html>"""   
    112115 
     116def getLanguagePreference() : 
     117    """Returns the preferred language.""" 
     118    languages = os.environ.get("HTTP_ACCEPT_LANGUAGE", "") 
     119    langs = [l.strip().split(';')[0] for l in languages.split(",")] 
     120    return "%s_%s" % (langs[0], langs[0].upper()) 
    113121 
    114122class PyKotaReportGUI(PyKotaTool) : 
    115123    """PyKota Administrative GUI""" 
     124         
    116125    def guiDisplay(self) : 
    117126        """Displays the administrative interface.""" 
     
    119128        print header % version.__version__ 
    120129        print self.body 
     130        print "<!-- %s -->" % str(getLanguagePreference()) 
    121131        print footer 
    122132         
     
    193203            self.reportingtool = openReporter(admin, "text", printers, ugmask.split(), isgroup) 
    194204            self.body += "<pre>%s</pre>" % self.reportingtool.generateReport() 
    195      
     205             
    196206if __name__ == "__main__" : 
    197     admin = PyKotaReportGUI() 
     207    os.environ["LC_ALL"] = getLanguagePreference() 
     208    admin = PyKotaReportGUI(lang=os.environ["LC_ALL"]) 
    198209    admin.form = cgi.FieldStorage() 
    199210    admin.guiAction() 
    200211    admin.guiDisplay() 
    201  
    202212    try : 
    203213        admin.storage.close() 
  • pykota/trunk/NEWS

    r1170 r1172  
    2222PyKota NEWS : 
    2323 
     24    - 1.16alpha2 : 
     25     
     26        - CGI script now partially supports browser's language preference 
     27         
    2428    - 1.16alpha1 : 
    2529     
  • pykota/trunk/pykota/version.py

    r1170 r1172  
    2222# 
    2323 
    24 __version__ = "1.16alpha1_unofficial" 
     24__version__ = "1.16alpha2_unofficial" 
    2525 
    2626__doc__ = """PyKota : a complete Printing Quota Solution for CUPS and LPRng."""