> I don't know about you, but generating HTML with pure Python code can be > messy--ONE reason why we introduce templateing languages in the first > place. Often (not always) the best way to end up with XHTML is to start > with a valid or almost-valid XML document and then infuse the dynamic > content.
Indeed. And in Python I do it with string formatting: template = """ <HTML> <HEAD> <TITLE>%(title)s</TITLE> </HEAD> <BODY> <H1>%(title)s</TITLE> <P>Author: %(author)s <P>something interesting here </BODY> """ dynamic_content = {} # fill in dynamic content here, or perhaps it's a dict read from a DB dynamic_content['title'] = 'How to write a Web service' dynamic_content['author'] = 'Someone Good' request.reply(template % dynamic_content) Bill _______________________________________________ Web-SIG mailing list Web-SIG@python.org Web SIG: http://www.python.org/sigs/web-sig Unsubscribe: http://mail.python.org/mailman/options/web-sig/archive%40mail-archive.com