Show
Ignore:
Timestamp:
01/21/08 21:00:58 (17 years ago)
Author:
jerome
Message:

Made the CGI scripts work again.
Moved even more functions to the utils module.
Removed the cgifuncs module, moved (and changed) content into utils.
If no output encoding defined, use UTF-8 : when wget is used to try
the CGI scripts, it doesn't set by default the accepted charset and
language headers.

Files:
1 modified

Legend:

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

    r3275 r3295  
    3030import cStringIO 
    3131 
    32 from pykota import version 
    33 from pykota.tool import PyKotaTool, PyKotaToolError 
    34 from pykota.cgifuncs import getLanguagePreference, getCharsetPreference 
     32import pykota.appinit 
     33 
     34from pykota import version, utils 
     35from pykota.tool import PyKotaTool 
     36from pykota.errors import PyKotaToolError 
     37 
    3538from pkpgpdls import analyzer, pdlparser 
    3639     
     
    4447  </head> 
    4548  <body> 
    46     <!-- %s %s --> 
    4749    <p> 
    4850      <form action="pykotme.cgi" method="POST" enctype="multipart/form-data"> 
     
    9698        """Displays the administrative interface.""" 
    9799        global header, footer 
    98         print header % (self.charset, _("PyKota Quotes"), \ 
    99                         self.language, self.charset, \ 
     100        content = [ header % (self.charset, _("PyKota Quotes"), \ 
    100101                        self.config.getLogoLink(), \ 
    101102                        self.config.getLogoURL(), version.__version__, \ 
    102103                        self.config.getLogoLink(), \ 
    103104                        version.__version__, _("PyKota Quotes"), \ 
    104                         _("Quote")) 
    105         print self.body 
    106         print footer % (_("Quote"), version.__doc__, version.__years__, version.__author__, version.__gplblurb__) 
     105                        _("Quote")) ] 
     106        content.append(self.body) 
     107        content.append(footer % (_("Quote"), version.__doc__, version.__years__, version.__author__, version.__gplblurb__)) 
     108        for c in content : 
     109            sys.stdout.write(c.encode(self.charset, "replace")) 
     110        sys.stdout.flush() 
    107111         
    108112    def error(self, message) : 
     
    187191             
    188192if __name__ == "__main__" : 
    189     admin = PyKotMeGUI(lang=getLanguagePreference(), charset=getCharsetPreference()) 
     193    utils.reinitcgilocale() 
     194    admin = PyKotMeGUI() 
    190195    admin.deferredInit() 
    191196    admin.form = cgi.FieldStorage()