I looked at HTMLGen a while ago- I didn't see what the advantage was. I wrote soem code similar to the example above, to generate a page.. It worked out fine.
However, I want to add HTML ouput to many of my other python programs, and I don't want to re-write this for each program. So some higher level of abastraction is needed, but I don't know how just yet. HTMLGen is no longer maintained, so I don't know what the best choice is. If you know the basics of HTMl, you can write a simple class to write the html, and just call a method from your program, so your app does not have any HTML in it. Philippe C. Martin wrote: > Thanks a bunch, > > I'm currently playing with HTMLGen (great but not in Python distrib ...) and > it look very good - Yet your code example looks simple enough for me to > look at that alternative. > > > > > Thomas Guettler wrote: > > > Am Thu, 09 Jun 2005 12:43:19 +0000 schrieb Philippe C. Martin: > > > >> Hi, > >> > >> I wish to use an easy way to generate reports from wxPython and feel > >> wxHtmlEasyPrinting could be a good solution. > >> > >> I now need to generate the HTML wxHtmlEasyPrinting can print > > > > I don't know wxPython, but generating HTML is very easy. > > > > Some people say mixing HTML and programming code is not good. > > > > But if you want to create dynamic pages with more logic than HTML > > this is the best solution. > > > > Example: Multiplication Table > > > > rows=[] > > heading=[] > > for i in range(1, 11): > > heading.append('<th bgcolor="grey">%s</th>' % i) > > cols=[] > > for j in range(1, 11): > > cols.append('<td align="right">%s</td>' % (i*j)) > > row='<tr><th bgcolor="grey">%s</th>%s</tr>' % (i, ''.join(cols)) > > rows.append(row) > > html=""" > > <html> > > <head><title>Multiplication Table</title></head> > > <body> > > <table border="1"> > > <tr> > > <th> </th> %s > > </tr> > > %s > > </table> > > </body> > > </html> """ % (''.join(heading), ''.join(rows)) > > > > I guess this looks more ugly in most template languages. > > > > HTH, > > Thomas > > -- http://mail.python.org/mailman/listinfo/python-list