From: Joel Goldstick on
Steven W. Orr wrote:
> I'm ok in python but I haven't done too much with web pages. I have a web page
> that is hand written in html that has about 1000 entries in a table and I want
> to convert the table from entries like this
>
> <tr>
> <td> Some Date String </td>
> <td> SomeTag </td>
> <td>
> <a href="localSubdir"> A Title </a>
> </td>
> <td>
> <a href="http://www.example.com/remote/path/something.html"
> Click
> </a>
> </td>
> <td> Some Comment </td>
> </tr>
>
> to
>
> SomePythonCall('Some Date String',
> 'SomeTag',
> 'localSubdir',
> "http://www.example.com/remote/path/something.html",
> 'Click',
> 'Some Comment')
>
> Can someone tell me what I should look at to do this? Is mod_python where I
> should start or are there things that are better?
>
> TIA
>
>
Quickest way to get where you are going is django or another (perhaps
smaller) framework. Since you say you are good with python, you could
get your website done in a weekend

Joel Goldstick

From: Miki on
> >> I'm ok in python but I haven't done too much with web pages. I have a web page
> >> that is hand written in html that has about 1000 entries in a table and I want
> >> to convert the table from entries like this
>
> >>     <tr>
> >>       <td> Some Date String </td>
> >>       <td> SomeTag </td>
> >>       <td>
> >>         <a href="localSubdir"> A Title </a>
> >>       </td>
> >>       <td>
> >>         <a href="http://www.example.com/remote/path/something.html"
> >>           Click
> >>         </a>
> >>       </td>
> >>       <td> Some Comment </td>
> >>     </tr>
>
> >> to
>
> >>    SomePythonCall('Some Date String',
> >>                 'SomeTag',
> >>                 'localSubdir',
> >>                 "http://www.example.com/remote/path/something.html",
> >>                 'Click',
> >>                 'Some Comment')
>
> >> Can someone tell me what I should look at to do this? Is mod_python where I
> >> should start or are there things that are better?
> > Have a look athttp://www.crummy.com/software/BeautifulSoup/.
>
> Thanks. But what I'm not seeing is any example of how to make this allowed to
> generate the html at run time.
Oh, I misunderstood you. You probably want one of the templating
systems out there, such as Mako, Jinja2, Cheetah, ...

Maybe http://cherrypy.org/wiki/intro/1 will be of help.

All the best,
--
Miki
From: alex23 on
"Steven W. Orr" <ste...(a)syslang.net> wrote:
> I'm ok in python but I haven't done too much with web pages. I have a web page
> that is hand written in html that has about 1000 entries in a table and I want
> to convert the table [into html]

Is the data coming from somewhere like a file or db? If so, I'd just
use something simple like this html generator:

http://pypi.python.org/pypi/html

It's a very clever use of context managers to handle element
nesting :)

If the data doesn't change very often, I'd just write a simple script
that parses the data source and builds a html page to server
statically. If it does, it's not much extra to convert that to a WSGI
script that returns the html string rather than creating a static
file.

I use this approach to produce a browseable table from a folder full
of files with fixed-pattern names.

Hope this helps.