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/dumpykota.cgi

    r3275 r3295  
    2929import urllib 
    3030 
    31 from pykota import version 
    32 from pykota.tool import PyKotaToolError 
     31import pykota.appinit 
     32from pykota import version, utils 
    3333from pykota.dumper import DumPyKota 
    34 from pykota.cgifuncs import getLanguagePreference, getCharsetPreference 
    3534 
    3635header = """Content-type: text/html;charset=%s 
     
    6867  </head> 
    6968  <body> 
    70     <!-- %s %s --> 
    7169    <p> 
    7270      <form action="dumpykota.cgi" method="GET" name="mainform" onsubmit="return checkvalues()"> 
     
    123121        """Displays the dumper interface.""" 
    124122        global header, footer 
    125         print header % (self.charset, _("PyKota Data Dumper"), \ 
    126                         self.language, self.charset, \ 
     123        content = [ header % (self.charset, _("PyKota Data Dumper"), \ 
    127124                        self.config.getLogoLink(), \ 
    128125                        self.config.getLogoURL(), version.__version__, \ 
    129126                        self.config.getLogoLink(), \ 
    130127                        version.__version__, _("PyKota Data Dumper"), \ 
    131                         _("Dump"), _("Please click on the above button")) 
    132         print self.htmlListDataTypes(self.options.get("data", ""))  
    133         print "<br />" 
    134         print self.htmlListFormats(self.options.get("format", "")) 
    135         print "<br />" 
    136         print self.htmlFilterInput(" ".join(self.arguments)) 
    137         print "<br />" 
    138         print self.htmlOrderbyInput(self.options.get("orderby", "")) 
    139         print "<br />" 
    140         print self.htmlSumCheckbox(self.options.get("sum", "")) 
    141         print footer % (_("Dump"), version.__doc__, version.__years__, version.__author__, version.__gplblurb__) 
     128                        _("Dump"), _("Please click on the above button")) ] 
     129        content.append(self.htmlListDataTypes(self.options.get("data", ""))) 
     130        content.append(u"<br />") 
     131        content.append(self.htmlListFormats(self.options.get("format", ""))) 
     132        content.append(u"<br />") 
     133        content.append(self.htmlFilterInput(" ".join(self.arguments))) 
     134        content.append(u"<br />") 
     135        content.append(self.htmlOrderbyInput(self.options.get("orderby", ""))) 
     136        content.append(u"<br />") 
     137        content.append(self.htmlSumCheckbox(self.options.get("sum", ""))) 
     138        content.append(footer % (_("Dump"), version.__doc__, version.__years__, version.__author__, version.__gplblurb__)) 
     139        for c in content : 
     140            sys.stdout.write(c.encode(self.charset, "replace")) 
     141        sys.stdout.flush() 
    142142         
    143143    def htmlListDataTypes(self, selected="") :     
     
    236236             
    237237if __name__ == "__main__" : 
    238     admin = PyKotaDumperGUI(lang=getLanguagePreference(), charset=getCharsetPreference()) 
     238    utils.reinitcgilocale() 
     239    admin = PyKotaDumperGUI() 
    239240    admin.deferredInit() 
    240241    admin.form = cgi.FieldStorage()