how to creating html files with python
hello, I have one strange requirement, I need to create html files through python and add some data from the database. it is a GUI based application developed in WX python. and the reports need to come out in html for some strange reason which is off topic to discuss here. but the point is that how do I do it? should I create a normal file object and write the html with the data into it or are there some modules to do it? regards, Krishnakant. -- http://mail.python.org/mailman/listinfo/python-list
Re: how to creating html files with python
krishnakant Mane schrieb: hello, I have one strange requirement, I need to create html files through python and add some data from the database. it is a GUI based application developed in WX python. and the reports need to come out in html for some strange reason which is off topic to discuss here. but the point is that how do I do it? should I create a normal file object and write the html with the data Essentially, yes. into it or are there some modules to do it? There are a bazillion templating systems out there. Beginning with python's own string interpolation, to KID, genshi, Mako, tenjin, cheeta, ... continue Search this NG for python templating engines, and you'd be overwhelmed by the answers. Happy chosing your evil, Diez -- http://mail.python.org/mailman/listinfo/python-list
Re: how to creating html files with python
On Oct 27, 12:12 pm, krishnakant Mane [EMAIL PROTECTED] wrote: I have one strange requirement, I need to create html files through python and add some data from the database. The only strange thing here is that you think this is a strange requirement :) This is quite typical, and practically required for web development. As Diez pointed out, your main problem will be which of the dozen or so template packages to pick. Depending on your criteria (expressive power, syntax close to python, performance, stability etc.) you may narrow it down to a handful. George -- http://mail.python.org/mailman/listinfo/python-list
Re: how to creating html files with python
On Oct 27, 12:02 pm, George Sakkis [EMAIL PROTECTED] wrote: The only strange thing here is that you think this is a strange requirement :) This is quite typical, and practically required for web development. I was wondering about this myself the other day. Suppose you wanted to get by on the cheap without setting up a whole new Joomla or WordPress installation for another smallish blog or website where you are the only poster, and all you need is simple CMS. How hard would it be to create, say, a calendar of events, or news postings using MySQL and Python and HTML. Create the page on your local machine using Python templating, and then just post the HTML code daily? I'm a rank amateur, but was wondering if this is silly and making work, or if one of those templating systems you all are mentioning would work for simple CMS and calendaring? Thanks, rd -- http://mail.python.org/mailman/listinfo/python-list
Re: how to creating html files with python
hi George, On 27/10/2007, George Sakkis [EMAIL PROTECTED] wrote: On Oct 27, 12:12 pm, krishnakant Mane [EMAIL PROTECTED] wrote: I have one strange requirement, I need to create html files through python and add some data from the database. The only strange thing here is that you think this is a strange requirement :) This is quite typical, and practically required for web development. As Diez pointed out, your main problem will be which of the dozen or so template packages to pick. Depending on your criteria I am finding it difficult to choose. my only requirement is to create an htmo file with normal html taggs but the values come from a database connection. so I want to get rid of doing the entire concatination right from start till end. I don't mind opening a file and doing file.write() but it will be nice of some module to help me get the data concatinated with taggs and rather even better if I can do complex things like creating an html table whos rows contain data coming from a result set. here I would like to have the tagging more like functions, some thing like report.bold(this must be bold ) and this function to return a line with the bolded html which looks in the file as b this must be bold /b so instead of I doing the concatination myself, python makes it easy. and I will have lot of complex tables etc to do like this. so please help me choose one. regards, Krishnakant. -- http://mail.python.org/mailman/listinfo/python-list
Re: how to creating html files with python
krishnakant Mane schrieb: [snip] so instead of I doing the concatination myself, python makes it easy. and I will have lot of complex tables etc to do like this. so please help me choose one. Did you actually looked for a template language as suggested here? Now to make your life easier: If you like XML, use genshi. If you plan to generate something else than HTML, use cheetah. Use google or whatever search engine you prefer to find those packages. cheers Paul -- http://mail.python.org/mailman/listinfo/python-list