PSP, Cheetah, PTL, ZOPE, etc ...

Dave Cole djc at object-craft.com.au
Sun Aug 5 22:18:28 EDT 2001


benji> Something I haven't seen presented here yet: When starting a
benji> new project to create web interfaces for several databases I
benji> decided against the templating approach (for reasons addressed
benji> elsewhere on this thread).  I started with HTMLgen, but soon
benji> found it to be lacking.  I wrote a simple OO-ized HTML
benji> generating library that has grown over the last year, but is
benji> still quite simple to use.  It reflects my desire to write
benji> Python code that looks like Python, but ultimately generates
benji> HTML.
benji> 
benji> Example:
benji> 
benji> # Build a table.
benji> table = Table(width='100%', border=1)
benji> table.newRow()
benji> table.newCell('foo')
benji> table.newCell(Font('bar', size='+1'), bgColor='#CCFFFF')
benji> table.newRow()
benji> table.newCell(NoBreak('A really long cell.'), columnSpan=2)
benji> print table

Something like that already exists:

        http://starship.python.net/crew/friedrich/HTMLgen/html/main.html

The Debian GNU/Linux distribution includes this as the htmlgen
package.

benji> The reason I choose this approach is that we are an
benji> all-programmer shop, where we have to do the HTML too.
benji> Therefore tightly integrating it to the code (but keeping
benji> presentation seperate from logic, etc.)  makes more sense than
benji> trying to design the HTML separately.
benji> 
benji> I'm hoping to clean up the code and release it soon, any
benji> interest?

There are some differences between your approach and that of HTMLgen.
I have no doubt that some people will prefer your approach.  By all
means release the code.

- Dave

-- 
http://www.object-craft.com.au



More information about the Python-list mailing list