def main2(dbfpath,dbpath): schema = makeSchema(dbfpath) sess = schema.quickStartup( filename=opj(dbpath,"raceman.db")) sess.progress("Generating reports...") if True: doc = Document("1") doc.h(1,"Raceman Generating OpenOffice documents") main3(doc,sess) outFile = opj(dbpath,"raceman_report.sxc") doc.save(outFile,showOutput=True) else: main3(console,sess)
def main(argv): console.copyleft(name="Lino/html2sxc", years='2005') parser = console.getOptionParser( usage="usage: %prog [options] HTMLFILE", description="""\ where HTMLFILE is a html document containg tables """ ) parser.add_option("-o", "--output", help="""\ generate to OUTFILE instead of default name. Default output filename is HTMLFILE with extension .sxc depending on content. """, action="store", type="string", dest="outFile", default=None) (options, args) = parser.parse_args(argv) if len(args) != 1: parser.print_help() sys.exit(-1) ifname = args[0] print ifname (basename,ext) = os.path.splitext(ifname) console.progress("Processing " +ifname+" ...") doc = Document(basename+".sxc") w = formatter.NullWriter() fmt = formatter.AbstractFormatter(w) parser = MyParser(fmt) parser.feed(open(ifname).read()) parser.close() for t in parser._tablesFound: dt = doc.table() for r in t: dt.addRow(*r) g=doc.generator(filename=options.outFile) g.save() if sys.platform == "win32" and console.isInteractive(): os.system("start %s" % g.outputFilename)
def main(argv): console.copyleft(name="Lino/html2sxc", years='2005') parser = console.getOptionParser(usage="usage: %prog [options] HTMLFILE", description="""\ where HTMLFILE is a html document containg tables """) parser.add_option("-o", "--output", help="""\ generate to OUTFILE instead of default name. Default output filename is HTMLFILE with extension .sxc depending on content. """, action="store", type="string", dest="outFile", default=None) (options, args) = parser.parse_args(argv) if len(args) != 1: parser.print_help() sys.exit(-1) ifname = args[0] print ifname (basename, ext) = os.path.splitext(ifname) console.progress("Processing " + ifname + " ...") doc = Document(basename + ".sxc") w = formatter.NullWriter() fmt = formatter.AbstractFormatter(w) parser = MyParser(fmt) parser.feed(open(ifname).read()) parser.close() for t in parser._tablesFound: dt = doc.table() for r in t: dt.addRow(*r) g = doc.generator(filename=options.outFile) g.save() if sys.platform == "win32" and console.isInteractive(): os.system("start %s" % g.outputFilename)
def main2(dbfpath, dbpath): schema = makeSchema(dbfpath) sess = schema.quickStartup(filename=opj(dbpath, "raceman.db")) sess.progress("Generating reports...") if True: doc = Document("1") doc.h(1, "Raceman Generating OpenOffice documents") main3(doc, sess) outFile = opj(dbpath, "raceman_report.sxc") doc.save(outFile, showOutput=True) else: main3(console, sess)