Friday, November 09, 2007

Twisted AJAX/COMET Tutorial Pre-release


As promised earlier, here is the new Athena tutorial!

Currently, the tutorial consists of a topical introduction and two example applications, built with the reader step-by-step. Note that this is still in branch and hasn't been reviewed for inclusion in trunk. Please feel free to leave comments to this blog post about the tutorial (good, bad and ugly). This will help us improve the content and prepare it for inclusion in trunk.

The tutorial includes detailed instructions on setting up an environment, obtaining the source code, and running the applications. There are also pointers on how to conceptually approach development with Nevow/Athena.

Due to concerns over code compactness, we pulled out the CSS that nicely styled the echo and chat tutorial apps. The curious can view the styled versions here:




And if you want to pretify your example apps, you can update the fragment templates per the links given below.




10 comments:

  1. It would be nice to have navigational links inside the tutorial sections i.e. next&prev

    ReplyDelete
  2. This is great. Thanks! Not things new for me, but I was planning a talk at my Python group and this will make great material for it. Much appreciated.

    ReplyDelete
  3. Calvin,

    Glad you like it! Glyph did the hard work of creating the initial code and pairing with me on the code in it's final (current) form. The trickiest bit was figuring out a good standard for running example code as part of the unit test suite.

    Good luck on the talk to your group!

    ReplyDelete
  4. Hello Duncan

    Really great tutorials!.

    I am interested in athena, nevow solutions. However I have just read about Orbited.
    Do you know it? If yes - could you describe in general main differences between athena and orbited solutions?.

    ReplyDelete
  5. Sławek,

    I had never heard of Orbited. At a quick glance of there site, I didn't see any links to a source code repository, so I can't tell you how mature the code base is. Their mail list seems to be very young (Aug 2007 is the earliest post I could find), and it looks like there are only three core developers.

    None of that's bad, and if there's community interest, there's every chance of that changing.

    They use libevent; Athena uses Twisted. They use their own HTTP server, Athena uses the Twisted HTTP server. Looking at their code examples, I find the Athena/Nevow approach that I laid out in the tutorial much more cohesive and thorough: I made an effort to capture in the tutorials the same conceptual unity that exists in the Athena code base. I do not get that same sense when I look at the Orbited code. Then again, I only spent a few minutes looking it over...

    Right now, given the history and my knowledge of Twisted, I trust that code base far more. But hey, who knows what the future holds?

    ReplyDelete
  6. thanks for the tutorial. this looks exactly what I'm looking for...
    Unfortunatelly, I have problems installing the examples. The first problem was easyly fixed: zope.interfaces must be installed.
    But the second one...
    When trying to install Nevow (Divmod/branches/athena-tutorials-2272-3/Nevow),
    I get a traceback with the last lines:
    File "/usr/lib/python2.5/site-packages/twisted/python/reflect.py", line 432, in namedAny
    obj = getattr(obj, n)
    AttributeError: 'module' object has no attribute 'function'
    This is happening when trying to import setupcommon.
    Are there any known problems with python2.5? On linux? Thanks

    ReplyDelete
  7. stedi,

    So glad this was what you were looking for and very sorry you haven't gotten it working yet. I'm actually away from the office this week but will be back on the weekend -- let me take a look at it then. I may have some questions for you about your setup, so it might be good to transition this to some email correspondence (I've updated my blogger profile so that my email address is now viewable). Once we get it sorted it, I can post a follow up message here for posterity :-)

    ReplyDelete
  8. Just a note: stedi got back to me later via email and let me know that the issue was system-specific and he was able to run the example code.

    ReplyDelete
  9. Hi, is Twisted/Divmod supposed to be Unix/Linux/Mac only? I tried to run your tutorial on Windows and the tests fail since they use os methods that don't work for Windows.

    ReplyDelete
  10. James, thanks for the heads up! Twisted is *definitely* for Windows too. Divmod software is also supposed to run on Windows (we have buildbots for Windows machines, and we're working with Microsoft to get even better Windows support).

    Could you do me a huge favor? Either email me the full traceback that you get when you try to run the tests on Windows, or (even better) submit a ticket here:
    http://divmod.org/trac/newticket

    If you submit a ticket, you'll need to register for an account. If you prefer to just send me the traceback, I believe my email address is accessible via my blogger profile.

    Thanks again, James!

    ReplyDelete