Exempel, fortsättning.. import traceback timetext = time.strftime("%y%m%d-%H%M", time.localtime(time.time())) f = open(join(constants.TRACEBACKDIR, timetext), 'w') f.write("Time of exception: %s\n\n" % timetext) traceback.print_exc(file=f) f.write("\n") f.write("Remote IP: %s\n" % req.connection.remote_ip) f.write("Request : %s\n" % req.the_request) f.close() f = open(join(constants.TRACEBACKDIR, timetext), 'r') ret = Error(req).response(title="Exception", errortext = "
%s" % f.read()) f.close() return ret class MainPageHandler(): def __init__(self, req): self.req = req def response(self): ...