Rich UI Webapps with TurboGears 2 and Dojo Screencast

By on March 31, 2008 10:12 am

The PyCon 2008 talk videos are making their way up to YouTube. My talk is not yet there, and the footage they’re putting up right now is the “raw” footage from the camera at the back of the room. I have posted a screencast version of my talk, “Rich UI Webapps with TurboGears 2 and Dojo”:

video thumbnail

This is basically the same talk I gave at PyCon, but I made a few tweaks to make all of the code easier to follow.

Speaking of the code, you can download the “” demo application to review the code at your leisure and run it on your own computer. The file is 10MB because it includes the complete Dojo toolkit, and I set it up using zc.buildout, so it’s trivial to get it running. Take a look at the README.txt file to get it running.

You can run the sample without the Comet functionality, but if you’d like to try the app with Comet you’ll want some kind of Bayeux server running on port 8001. I used the Twisted Cometd server for my demo.


  • Pingback: SitePen Blog » PyCon 2008 Report()

  • Pingback: Blue Sky On Mars » Blog Archive » Rich UI Webapps with TurboGears 2 and Dojo Screencast()

  • I tried to click on the link for downloading the example but failed.

  • @Domingo, I just tried it and it worked for me. Note that it is a 10MB .tgz, so you might want to right-click, save as …, and see if that solves your issue.

  • Kevin,

    is there a technical reason for using the twisted cometd server instead, let’s say, orbited?

  • @Domingo: Not precisely a technical reason… Dojo includes Bayeux protocol support, so I figured I’d just use dojox.cometd rather than a separate JavaScript library (which is what Orbited would require).

    You can actually use any of the Bayeux servers.

  • Kevin,

    I ve just tried to follow carefully the steps involved in running de demo.

    I indeed have installed tg2 from subversion and pylons as of mercurial. With both I can quickstart tg2 projects without a problem.

    After buildout , I had to edit myself lib/ to import tmpl_context as context instead of plain context. Also I edited from the tg2 intstalled under eggs because tries to use a subscript which is empty. After these changes I could start the project with bin/paster serve development.ini , but when opening browser in localhost port 8080 I got an internal error raised by WebError, sort of….

    File “/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/WebError-0.8a-py2.5.egg/weberror/exceptions/”, line 281, in collectLine
    if locals.has_key(‘__traceback_supplement__’):
    AttributeError: ‘Context’ object has no attribute ‘has_key’

    Any hint?

  • Hi Domingo,

    From what you’re describing, it looks like there have been at least a couple of changes in WebError, Pylons or TG2. That’s the trouble of working with pre-release software. I’m sure the changes are minor, though.

    One thing to note: the tarball included Pylons and TG2 in cache/dist. You shouldn’t have needed to install them. (And, in fact, the buildout shouldn’t use any code that you have installed in your system site-packages directory…)

    I’ll take a look over the next couple of days to see if I can change something in the buildout to keep it pegged at the working versions and fix any glitches I find. Obviously, it worked when I did the original demo and when I packaged it up :)


  • Kevin,

    every module included in cache/dist was copied by buildout to eggs directory . All of them but TG2 and Pylons. I don’t know if buildout had a problem with that, because I had already recent versions of TG2 ( svn ) and Pylons.

    Tks :)

  • Hi Domingo,

    I just downloaded the tarball that’s attached to this blog post and running followed by bin/buildout worked just fine.

    Can you try changing the buildout.cfg file so that the list of eggs looks like this:

    eggs = TurboGears2 ==2.0a1dev-r4169
    Pylons ==0.9.7dev-20080311
    FormEncode <0.9

    I think what's happening is that the buildout is indeed finding the TG2 and Pylons versions you have installed. So, this config change will peg the version numbers at the ones in the cache.

  • p.s. make sure that the lines after the “eggs =…” line have leading spaces.

  • Kevin,

    it worked!

    All was about editing buildout.cfg as you suggested.

    Tks a lot!

  • Great! I’ve just updated the sample code to have the new buildout.cfg file. Also, using Peter Higgins’ recent “dojo-mini” post as a guide, I’ve reduced the size of the tarball from more than 10MB to 1.8MB.

  • Kevin,

    it would be great if you can add to the README file instrucciones on how to install the twisted cometd server because is not that easy. It needs twisted svn because depends on web2 submodule which is not installed via easy_install. Indeed I have some trouble to make it run right now.

  • Yeah, Twisted and easy_install don’t seem to play well together yet.

    What I ended up doing was using virtualenv and installing everything into there. I’m not sure that I have any great advice for installing that package at this point (with some work, the installation could be automated, and that would be a better solution).

    Note that any Bayeux server should work fine. I happened to use the Twisted one, but it’s possible that one of the others listed here:

    may be a quicker install for people who don’t already have Twisted and lxml set up.

  • Pingback: SitePen Blog » The Tech of SitePen Support()

  • Vicente Jimenez

    I have two question not directly related to the subject of the post.

    How do you haved recorded this screencast? Do you used Camtasia Studio, ScreenFlow or anything similar? I’m asking because I’m looking for free alternatives.

    And, what is the brand and model of that funny mic that you use?

    Thanks in advance.

  • Hi Vicente,

    I used ScreenFlow, which is well worth the $99 if you want to do a lot of screencasting. You won’t currently find anything like it for free.

    The mic is a Blue Snowball.


  • Hi Kevin,

    Thanks for providing this interesting demo. I’m curious to know if you think the same result could be achieved with toscawidgets? From the TG2 site it looks like they are pushing in that direction. Presumably using TW would result in more Python code on the server and less custom js? Interested to know your view…

  • @Jamie: I think you might want to read the thread [1] about TW and rich UI in the tg-trunk mailing list.