Show
Ignore:
Timestamp:
05/05/05 00:01:38 (19 years ago)
Author:
jerome
Message:

Improved stability and allowed tracebacks in CGI scripts.
Improved pykotme.cgi to display the cost of print jobs when the user is logged-in.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/pykota/tool.py

    r2214 r2229  
    5555    __str__ = __repr__ 
    5656     
    57 def crashed(message) :     
     57def crashed(message="Bug in PyKota") :     
    5858    """Minimal crash method.""" 
    5959    import traceback 
     
    218218        sys.exit(0) 
    219219         
    220     def crashed(self, message) :     
     220    def crashed(self, message="Bug in PyKota") :     
    221221        """Outputs a crash message, and optionally sends it to software author.""" 
    222222        msg = crashed(message) 
     223        fullmessage = "========== Traceback :\n\n%s\n\n========== sys.argv :\n\n%s\n\n========== Environment :\n\n%s\n" % \ 
     224                        (msg, \ 
     225                         "\n".join(["    %s" % repr(a) for a in sys.argv]), \ 
     226                         "\n".join(["    %s=%s" % (k, v) for (k, v) in os.environ.items()])) 
    223227        try : 
    224228            crashrecipient = self.config.getCrashRecipient() 
    225229            if crashrecipient : 
    226230                admin = self.config.getAdminMail("global") # Nice trick, isn't it ? 
    227                 fullmessage = "========== Traceback :\n\n%s\n\n========== sys.argv :\n\n%s\n\n========== Environment :\n\n%s\n" % \ 
    228                                 (msg, \ 
    229                                  "\n".join(["    %s" % repr(a) for a in sys.argv]), \ 
    230                                  "\n".join(["    %s=%s" % (k, v) for (k, v) in os.environ.items()])) 
    231231                server = smtplib.SMTP(self.smtpserver) 
    232232                server.sendmail(admin, [admin, crashrecipient], \ 
     
    236236        except : 
    237237            pass 
     238        return fullmessage     
    238239         
    239240    def parseCommandline(self, argv, short, long, allownothing=0) :