#! rnews 2612
Newsgroups: comp.lang.python
Path: 
news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.abs.net!attws2!ip.att.net!NetNews1!xyzzy!nntp
From: Harry George <[EMAIL PROTECTED]>
Subject: Re: Generating HTML from python
X-Nntp-Posting-Host: cola2.ca.boeing.com
Content-Type: text/plain; charset=us-ascii
Message-ID: <[EMAIL PROTECTED]>
User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4
Lines: 70
Sender: [EMAIL PROTECTED]
Organization: The Boeing Company
References: <[EMAIL PROTECTED]> <[EMAIL PROTECTED]>
Mime-Version: 1.0
Date: Fri, 10 Jun 2005 13:16:36 GMT
Xref: news.xs4all.nl comp.lang.python:381106

"Philippe C. Martin" <[EMAIL PROTECTED]> writes:

> PS: I am looking at the formatter module which seems to be related to HTML
> somehow, but without any code sample I'm a bit lost


As others have noted, if you need any computation at all, it is easier
to write directly in python.

I came to python from perl, where I used CGI.pm.  To get that effect,
I wrote my own CGIpm.py and used it for a while.  
http://www.seanet.com/~hgg9140/comp/index.html

But (at the suggestion of others in this newsgroup), I then tried
writing directly.  The net effect is trivial html generation, with all
the power of python at your fingertips.

Note: 
To save even more time, I made a CGI template that includes this main:

#============================
if __name__=="__main__":
    mystart()
    #cgi.print_environ_usage()
    #cgi.print_environ()
    form = cgi.FieldStorage()
    try:
        if len(form)==0:            
            send_form1()
        else:
            form_name=form['form_name'].value
            if form_name=='form1':
                recv_form1()
    except StandardError, e:
        print "\n<BR>ERROR: %s\n" % e
    myend()    

To support a stateless world:

1. Each form has a send_xyz and recv_xyz function.  The end of each
recv_xyz decides what send_xyz to do next.

2. mystart and myend handle opening and closing the http and html.
They also handle state save/restore as needed (pickle or database).

> 
> 
> Philippe C. Martin wrote:
> 
> > 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 need to
> > have a title followed by lines of text that do not look too ugly. If
> > possible I would like to use an existing module.
> > 
> > Q1) Is there such a module ?
> > Q2) Is my approach fairly good ?
> > 
> > Regards,
> > 
> > Philippe
> 

-- 
[EMAIL PROTECTED]
6-6M21 BCA CompArch Design Engineering
Phone: (425) 294-4718
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to