def checkrest(rest): fname = traceback.extract_stack()[-2][2] i = 0 while True: if i == 0: filename = "%s.txt" % (fname,) else: filename = "%s_%s.txt" % (fname, i) tempfile = tempdir.join(filename) if not tempfile.check(): break i += 1 tempfile.write(rest) restcheck(tempfile) return tempfile.new(ext=".html").read()
def checkrest(rest, filename): tempfile = tempdir.join(filename) tempfile.write(rest) restcheck(tempfile) return tempfile.new(ext='.html').read()