Peter's Blog

Redefining the Impossible

TurboGears Mania


Coding away with TurboGears and found that glorious nirvava where whatever I tried Just Worked. Kid, SQLObjects and cherrypy are nice and clean and turbogears has generated a nice boilerplate framework. Going through the code of the various librarys while debugging, there is magic in the way they are working but it is not causing me big troubles as the api's they present are nice and clean. Python is such a lovely language I always felt it would be great for web development and now it feels like I have the tools.

I commented previously on SQLObjects support for introspection and I was wrong here as the help command (possibly docstrings in general?) is broken and generates an exception but the online documents are fairly comprehensive.

I have a heavy cold and hence had one of those tortured nights sleep with recurring dreams. I kept seeing Kid's XML element tree sitting in memory, branches being swapped in and out and the resulting document changing in wonderful ways. It was not a bad dream. I woke up thinking it was a great way to manipulate a document compared to primitive string substitution. I have never really tried DOM models before, being reluctant to use all that memory, but now that memory is cheap I shouldn't be so cautious. Playing with SAX parsers is a pain, if I have to write another state machine I'll scream.

Another discovery, the TurboGears command `tg-admin shell` somehow picked up IPython and I was able to play with the database api whil admiring the pretty colours.

It was nice until I tried porting a theme from php and ran into an annoying works-in-ie-but-not-firefox problem. There are some things that even the nicest development environments cannot help with. I tried using html-kit to clean up the template code and it is indeed easy to preview kid templates in a browser, they Just Work.

Tip for the Day: although kid templates are xml it is better to tell WingIDE they are html as it avoids a limitation of the xml syntax highlighting where it treats Processing Instructions as errors and marks most of the file as a syntax error, making the editor run pretty sluggishly.


Lee Connell Says:

over 2 years ago

I am just starting with python and am using wingide. I am considering turbogears for web development. You say in your "Tip of the Day" that you are using kid templates within wingide.

Is wingide able to debug web apps using kid/cheetah templating system?

I wanted to try this out using mod_python to get use to the feel of creating python web apps before I install turbogears.

Peter Says:

over 2 years ago

WingIDE can debug applications that use kid or cheetah templates. These are just python libraries. You cannot set a breakpoint on a line in a template but that would be asking a lot.

TurboGears is a web application framework, mod_python is one way of running that framework. It is possible to learn turbogears first, debugging it as a stand-alone server with WingIDE and then use mod_python to run it in a production environment. I am not sure that WingIDE can be used to debug applications running within mod_python.

Peter

Have Your Say

I welcome constructive comments or questions but I reserve the right to delete any comments that displease me.

Who are you?

(Optional) If you enter an email address here I might email you back. Your email address will not be sold to spammers or shown anywhere

What do you have to say?