473,396 Members | 1,707 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

HTML writer

Is there a standard solution for writing HTML web pages with Python? I
don't know that much about web programming, but basically I want to generate
some internal reports on a web page.

It doesn't need to be fancy, just basic tables and linking, maybe indexing
and navigation, but I want it to all look nice and I want to be able to
change the formatting easily without combing through source code (hence my
next question about CSS).

I know there newer things like CSS and XHTML -- are these more or less
effort to generate? i.e. are they more complicated, or do they have more
uniform syntax? What do they necessarily buy you?

I searched the python website and I have seen HTML parsers, but no examples
of generators. I searched for "Python HTML" and "Python CSS" and found some
stuff -- but it doesn't seem like there is a "standard" solution that is
EASY for non-expert web programmers to use. I am an experienced
programming, but I don't know that much about all the alphabet soup that is
web programming.

thanks,
MB
Jul 18 '05 #1
8 2913
You could always try HTMLgen, though I don't know how much CSS it supports.

HTH

J

Moosebumps wrote:
Is there a standard solution for writing HTML web pages with Python? I
don't know that much about web programming, but basically I want to generate
some internal reports on a web page.

It doesn't need to be fancy, just basic tables and linking, maybe indexing
and navigation, but I want it to all look nice and I want to be able to
change the formatting easily without combing through source code (hence my
next question about CSS).

I know there newer things like CSS and XHTML -- are these more or less
effort to generate? i.e. are they more complicated, or do they have more
uniform syntax? What do they necessarily buy you?

I searched the python website and I have seen HTML parsers, but no examples
of generators. I searched for "Python HTML" and "Python CSS" and found some
stuff -- but it doesn't seem like there is a "standard" solution that is
EASY for non-expert web programmers to use. I am an experienced
programming, but I don't know that much about all the alphabet soup that is
web programming.

thanks,
MB


Jul 18 '05 #2
Moosebumps wrote:
Is there a standard solution for writing HTML web pages with Python? I
don't know that much about web programming, but basically I want to generate
some internal reports on a web page.
There are several possible HTML generators for Python:
HTMLgen http://starship.python.net/crew/frie...html/main.html
HyperText http://dustman.net/andy/python/HyperText/
XIST http://www.livinglogic.de/Python/xist/
[...]
I know there newer things like CSS and XHTML -- are these more or less
effort to generate? i.e. are they more complicated, or do they have more
uniform syntax? What do they necessarily buy you?
You can do more styling with CSS than you can do with HTML.
[...]


Bye,
Walter Dörwald

Jul 18 '05 #3
Moosebumps wrote:
I know there newer things like CSS and XHTML -- are these more or less
effort to generate? i.e. are they more complicated, or do they have
more uniform syntax? What do they necessarily buy you?


I don't know anything about Python in relation to dynamic web pages, but
I've worked quite a lot with PHP in this respect. XHTML is a very clean
implementation of HTML, and should, at least in principle, be much more
easily rendered by any browser than ninetyish tag soup. From a coder's
point of view, it also of course has a lot of aesthetic appeal.

The nicest thing about the XHTML/CSS combination, is the clean division
between structure and presentation. The <FONT> tag should go the same
way as the GOTO.

I would recommend to read up the specs of XHTML 1.0 on
<url:http://www.w3c.org/>, write some experimental markup, and then try
to validate it on <url:http://validator.w3.org/>. You'll get the hang
of it after some iterations.

There are many good tutorials on the net for writing XHTML and CSS; do a
search on Google. You can of course also learn an awful lot by viewing
the source of other people's validating pages.

regards,
--
Leif Biberg Kristensen
http://solumslekt.org/
Validare necesse est
Jul 18 '05 #4
"Walter Dörwald" <wa****@livinglogic.de> wrote in message
news:40**************@livinglogic.de...
Moosebumps wrote:
Is there a standard solution for writing HTML web pages with Python? I
don't know that much about web programming, but basically I want to generate some internal reports on a web page.


There are several possible HTML generators for Python:
HTMLgen http://starship.python.net/crew/frie...html/main.html
HyperText http://dustman.net/andy/python/HyperText/
XIST http://www.livinglogic.de/Python/xist/


Thanks for those links, they look like what I'm looking for. Does anyone
have any comment on which one of these requires you to have the least amount
specific web programming knowledge? i.e. I know basic HTML, and I am an
experienced C programmer, but haven't really delved into the specifics of
it... never really wanted to clutter up my mind with the alphabet soup of
web programming : ). I was thinking that there was some Python library
that would wrap the functionality of these languages in some nice consistent
OO python interface. It looks like all of these are exactly that, from what
I gather, which is great.

That is, I would not like any specific HTML tags anywhere in my own code,
and it seems like that is what they will allow me to do. But I would be
interested to hear opinions/experiences with these packages.

thanks,
MB
Jul 18 '05 #5
Moosebumps wrote:
"Walter Dörwald" <wa****@livinglogic.de> wrote in message
news:40**************@livinglogic.de...
[...]

There are several possible HTML generators for Python:
HTMLgen http://starship.python.net/crew/frie...html/main.html
HyperText http://dustman.net/andy/python/HyperText/
XIST http://www.livinglogic.de/Python/xist/

Thanks for those links, they look like what I'm looking for. Does anyone
have any comment on which one of these requires you to have the least amount
specific web programming knowledge?


Each of them requires you to know what the HTML tags mean.
i.e. I know basic HTML, and I am an
experienced C programmer, but haven't really delved into the specifics of
it... never really wanted to clutter up my mind with the alphabet soup of
web programming : ). I was thinking that there was some Python library
that would wrap the functionality of these languages in some nice consistent
OO python interface. It looks like all of these are exactly that, from what
I gather, which is great.

That is, I would not like any specific HTML tags anywhere in my own code,
and it seems like that is what they will allow me to do. But I would be
interested to hear opinions/experiences with these packages.


As the author of XIST I'm naturally biased, but one advantange of XIST
is that it's still actively maintained. HTMLgen and HyperText don't
seem to be.

To see an example take a look at
http://www.livinglogic.de/viewcvs/in...xist/HOWTO.xml.
This XML file doesn't contain any HTML tags, but gets converted to
HTML (see http://www.livinglogic.de/Python/xist/Howto.html), to
XSL-FO (see http://www.livinglogic.de/Python/xist/Howto.fo) and
PDF (see http://www.livinglogic.de/Python/xist/Howto.pdf)

HTH,
Walter Dörwald

Jul 18 '05 #6
Moosebumps wrote:
That is, I would not like any specific HTML tags anywhere in my own code,
and it seems like that is what they will allow me to do. But I would be
interested to hear opinions/experiences with these packages.


I spent a couple of days last week getting to know each of these. I
found HTMLgen as I was getting desperate with the tag soup in my code
and quickly converted the code to use it. Then I found out it only does
HTML 3.2, missing end tags of elements and such. Some parts of the model
also weren't as generic as they should have been.

Next I stumbled upon HyperText, which seemed to fix all the
incosistencies of HTMLgen, and also output XHTML 1.0. THe problem was
that I found no way to use web forms with it. The 'name'-attribute of an
input tag seemed to be impossible to set(ie. foo.name didn't do the
right thing, foo['name'] was illegal and there weren't any obvious false
names like klass <-> class). Fixing this would have been easy, but I
decided to look for alternatives.

The final option seemed to be XIST, of which HTML seems to be only small
part. It seems to implement HTML in a consistent fashion, allowing all
the necessary tag attributes to be set and otherwise providing a nice
interface to the horrible world of web :)

-- Tuure Laurinolli
Jul 18 '05 #7
Thanks to all for the feedback -- that was very useful! I think I will go
with XIST.

MB

"Tuure Laurinolli" <tu***@laurinolli.net> wrote in message
news:c4**********@plaza.suomi.net...
Moosebumps wrote:
That is, I would not like any specific HTML tags anywhere in my own code, and it seems like that is what they will allow me to do. But I would be
interested to hear opinions/experiences with these packages.


I spent a couple of days last week getting to know each of these. I
found HTMLgen as I was getting desperate with the tag soup in my code
and quickly converted the code to use it. Then I found out it only does
HTML 3.2, missing end tags of elements and such. Some parts of the model
also weren't as generic as they should have been.

Next I stumbled upon HyperText, which seemed to fix all the
incosistencies of HTMLgen, and also output XHTML 1.0. THe problem was
that I found no way to use web forms with it. The 'name'-attribute of an
input tag seemed to be impossible to set(ie. foo.name didn't do the
right thing, foo['name'] was illegal and there weren't any obvious false
names like klass <-> class). Fixing this would have been easy, but I
decided to look for alternatives.

The final option seemed to be XIST, of which HTML seems to be only small
part. It seems to implement HTML in a consistent fashion, allowing all
the necessary tag attributes to be set and otherwise providing a nice
interface to the horrible world of web :)

-- Tuure Laurinolli

Jul 18 '05 #8
has
"Moosebumps" <mo********@moosebumps.com> wrote in message news:<yL*******************@newssvr25.news.prodigy .com>...
Is there a standard solution for writing HTML web pages with Python? I
don't know that much about web programming, but basically I want to generate
some internal reports on a web page.
First ask yourself if you need to generate pages dynamically, or is
pre-rendering and serving them up statically fine? The latter is much,
much simpler to code for. For what you describe this may be all you
need. There's no shortage of frameworks for doing the former though (I
believe Quixote is well regarded as a "programmer-friendly" solution,
for example).

For templating, as long as you're comfy with a modicum of OO
programming then I'd recommend my HTMLTemplate module:
<http://freespace.virgin.net/hamish.sanderson/htmltemplate.html>.
Compiles HTML templates to a simple Python object model than can be
manipulated programmatically. Small and simple with no external
dependencies, clean separation between code and markup, and a very
clean, compact API; easily outstrips the old-school bloatware
ASP/PSP-style systems with their horrible code-in-markup soup.

On the offchance you need to do arbitary markup generation (for
generating really irregular tables and stuff that can't easily be
templated), there's always HTMLgen but it's pretty old and hoary now.
Donovan Preston's Nevow.Stan module is much more modern; see
<http://www.python.org/pycon/dc2004/papers/60/Nevow2004Tutorial.html>
for an introduction.

I know there newer things like CSS and XHTML -- are these more or less
effort to generate? i.e. are they more complicated, or do they have more
uniform syntax? What do they necessarily buy you?
CSS (cascading style sheets) are for styling (and - if you're brave -
page layout). Absolutely fine for styling text (waaay nicer than using
<font> tag crap). Many browsers still have problems with more complex
presentational stuff, but it doesn't sound like you'll be needing
that. Not something you should have to generate programmatically -
whole point of CSS being you just write it once and apply it to your
entire site.

XHTML is just a tidied up version of the HTML standard; enforces a few
things that were optional in HTML, e.g. correct closing of element
tags, the main advantage of this being it can be parsed, manipulated,
etc. as XML.

I am an experienced
programming, but I don't know that much about all the alphabet soup that is
web programming.


Yeah, there's a lot o' crap to avoid out there. Still, a good start'd
be finding yourself a nice modern introduction to writing HTML and
CSS, and go from there. There's scads of stuff online for this - main
problem's knowing the good from the bad. Reckon you some find some
good links at <http://webstandards.org/learn/standards/> (though you
may have to sift through a bit of geeky buzzword evangelism waffle to
get to it:). You won't need the advanced stuff and the basics are
easy. (Honest.<g> Hint: if a tutorial makes it sound complicated, find
a better tutorial!)

HTH
Jul 18 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Allan Bredahl | last post by:
Hi All I'm trying hard to find out how to transform XML to HTML using XSLT files. I have searched all over for some examples on how to do this, but I have had no succes with any of them. ...
0
by: a | last post by:
Save text file as html kloepper 17:42 23 Jul '04 I'm using httpwebresponse and a StringBuilder to return a stream that originates as a file with the .txt suffix (My download code converts the html...
6
by: guy | last post by:
Does .NET have a class or set of functions that facilitate the creating and writing of html files? I have been creating files in streams and constructing html strings and writing them out but it...
5
by: Rick Spiewak | last post by:
I need to generate a "buy" button as part of an ASP.NET page - this consists of a small HTML form with hidden fields, conforming to the requirements of a merchant credit card processor. PayPal is...
3
by: Ryan McLean | last post by:
Hello everyone! What I am trying to accomplish is as follows: I have a .aspx page where I display the user's information. This consists of a datagrid, several labels, etc. I would like to...
17
by: Lloyd Sheen | last post by:
This IDE is driving me nuts. I needed another button so I copied an existing one, changed the Text and the id and position by drag and drop. Well then I run and get the following: Control...
2
by: Chad | last post by:
In our application, I would like to send out HTML mail. TO do so, I must do something like this: Mail.Body = <raw HTMLTEXT String> Hence, I would like to know how to get the HTML text for Web...
2
by: daFou | last post by:
Hi All. All I want to do is get the HTML of a control on my page at postback into a string in my code behind. In ASP.NET 1.0 this used to be simple: Dim lStringWriter As...
6
by: JackO | last post by:
Does anyone have an example in VB.NET on how to create an HTML file.
6
by: Lloyd Sheen | last post by:
Perhaps I have missed something but what I would like to do is have a more "controlled" method of generating HTML from a web service. I can create items using HtmlTable, HtmlTableRow, and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.