Show
Ignore:
Timestamp:
09/27/08 22:02:37 (16 years ago)
Author:
jerome
Message:

Removed unnecessary spaces at EOL.

Files:
1 modified

Legend:

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

    r3411 r3413  
    1111# the Free Software Foundation, either version 3 of the License, or 
    1212# (at your option) any later version. 
    13 #  
     13# 
    1414# This program is distributed in the hope that it will be useful, 
    1515# but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1616# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1717# GNU General Public License for more details. 
    18 #  
     18# 
    1919# You should have received a copy of the GNU General Public License 
    2020# along with this program.  If not, see <http://www.gnu.org/licenses/>. 
     
    3838 
    3939from pkpgpdls import analyzer, pdlparser 
    40      
     40 
    4141 
    4242header = """Content-type: text/html;charset=%s 
     
    6969          </tr> 
    7070        </table>""" 
    71      
     71 
    7272footer = """ 
    7373        <table> 
     
    7777            </td> 
    7878          </tr> 
    79         </table>   
     79        </table> 
    8080      </form> 
    8181    </p> 
     
    8484      <font size="-2"> 
    8585        <a href="http://www.pykota.com/">%s</a> 
    86         &copy; %s %s  
     86        &copy; %s %s 
    8787        <br /> 
    8888        <pre> 
     
    9292    </p> 
    9393  </body> 
    94 </html>"""   
     94</html>""" 
    9595 
    9696class PyKotMeGUI(PyKotaTool) : 
     
    106106                        _("Quote")) ] 
    107107        content.append(self.body) 
    108         content.append(footer % (_("Quote"),  
    109                                  version.__doc__,  
    110                                  version.__years__,  
    111                                  version.__author__,  
     108        content.append(footer % (_("Quote"), 
     109                                 version.__doc__, 
     110                                 version.__years__, 
     111                                 version.__author__, 
    112112                                 saxutils.escape(version.__gplblurb__))) 
    113113        for c in content : 
    114114            sys.stdout.write(c.encode(self.charset, "replace")) 
    115115        sys.stdout.flush() 
    116          
     116 
    117117    def error(self, message) : 
    118118        """Adds an error message to the GUI's body.""" 
    119119        if message : 
    120120            self.body = '<p><font color="red">%s</font></p>\n%s' % (message, self.body) 
    121          
    122     def htmlListPrinters(self, selected=[], mask="*") :     
     121 
     122    def htmlListPrinters(self, selected=[], mask="*") : 
    123123        """Displays the printers multiple selection list.""" 
    124124        printers = self.storage.getMatchingPrinters(mask) 
     
    132132        message += '</select></td></tr></table>' 
    133133        return message 
    134          
     134 
    135135    def guiAction(self) : 
    136136        """Main function""" 
     
    143143                    printersfield = [ printersfield ] 
    144144                printers = [self.storage.getPrinter(p.value) for p in printersfield] 
    145             else :     
     145            else : 
    146146                printers = self.storage.getMatchingPrinters("*") 
    147             if self.form.has_key("inputfile") :     
     147            if self.form.has_key("inputfile") : 
    148148                inputfile = self.form["inputfile"].value 
    149                  
    150         if os.environ.get("REMOTE_USER") is not None :         
    151             self.body += self.htmlListPrinters(printers or [])             
     149 
     150        if os.environ.get("REMOTE_USER") is not None : 
     151            self.body += self.htmlListPrinters(printers or []) 
    152152            self.body += "<br />" 
    153153        self.body += _("Filename") + " : " 
     
    158158                parser = analyzer.PDLAnalyzer(cStringIO.StringIO(inputfile)) 
    159159                jobsize = parser.getJobSize() 
    160             except pdlparser.PDLParserError, msg :     
     160            except pdlparser.PDLParserError, msg : 
    161161                self.body += '<p><font color="red">%s</font></p>' % msg 
    162162                jobsize = 0 # unknown file format ? 
    163             else :     
     163            else : 
    164164                self.body += "<p>%s</p>" % (_("Job size : %i pages") % jobsize) 
    165                  
     165 
    166166            remuser = os.environ.get("REMOTE_USER") 
    167167            # special hack to accomodate mod_auth_ldap Apache module 
    168168            try : 
    169169                remuser = remuser.split("=")[1].split(",")[0] 
    170             except :     
     170            except : 
    171171                pass 
    172             if not remuser :     
     172            if not remuser : 
    173173                self.body += "<p>%s</p>" % _("The exact cost of a print job can only be determined for a particular user. Please retry while logged-in.") 
    174             else :     
    175                 try :     
     174            else : 
     175                try : 
    176176                    user = self.storage.getUser(remuser) 
    177177                    if user.Exists : 
    178178                        if user.LimitBy == "noprint" : 
    179179                            self.body += "<p>%s</p>" % _("Your account settings forbid you to print at this time.") 
    180                         else :     
     180                        else : 
    181181                            for printer in printers : 
    182182                                upquota = self.storage.getUserPQuota(user, printer) 
     
    184184                                    if printer.MaxJobSize and (jobsize > printer.MaxJobSize) : 
    185185                                        msg = _("You are not allowed to print so many pages on printer %s at this time.") % printer.Name 
    186                                     else :     
     186                                    else : 
    187187                                        cost = upquota.computeJobPrice(jobsize) 
    188188                                        msg = _("Cost on printer %s : %.2f") % (printer.Name, cost) 
    189189                                        if printer.PassThrough : 
    190190                                            msg = "%s (%s)" % (msg, _("won't be charged, printer is in passthrough mode")) 
    191                                         elif user.LimitBy == "nochange" :     
     191                                        elif user.LimitBy == "nochange" : 
    192192                                            msg = "%s (%s)" % (msg, _("won't be charged, your account is immutable")) 
    193193                                    self.body += "<p>%s</p>" % msg 
    194194                except : 
    195195                    self.body += '<p><font color="red">%s</font></p>' % self.crashed("CGI Error").replace("\n", "<br />") 
    196              
     196 
    197197if __name__ == "__main__" : 
    198198    utils.reinitcgilocale() 
     
    204204    try : 
    205205        admin.storage.close() 
    206     except (TypeError, NameError, AttributeError) :     
     206    except (TypeError, NameError, AttributeError) : 
    207207        pass 
    208          
     208 
    209209    sys.exit(0)