I've looked a lot at chatola, and it's been a really good learning experience. But, chatola, as shipped is broke - at least on firefox 2 on OS X. The problem occurs because athena is not correctly escaping quotes in the filled stan templates. So, if any of your messages contain single quotes, you get a javascript error. Also - any use of the change nick or change topic automatically includes single quotes into a message string, and thus breaks when interpreted as javascript. A stupid simple fix is to simply change the %r interpolation on lines 90 and 98 of chatola.py to something like %s: self.content(changer, 'changed the topic to %r.' % (topic, ))) becomes self.content(changer, 'changed the topic to %s.' % (topic, ))) or even self.content(changer, 'changed the topic to "%s"' % (topic, ))) Now at least, you're not breaking automatically whenver changing topic or nickname. And then I could write custom code to properly escape the quotes in the stan template. But this violates some cental ideas that at least some of you have - namely that you don't want the application developer escaping quotes. And I assume if I do this, it could easily break in the future. I can explain in greater detail, but am throwing this out as is so that it's not too long to read ;) I can also send a code snippet if you don't want to use the chatola code. Dav Clark 917-544-8408 Dav Clark 917-544-8408
On Wed, 11 Jul 2007 22:13:15 -0400, Dav Clark
I've looked a lot at chatola, and it's been a really good learning experience. But, chatola, as shipped is broke - at least on firefox 2 on OS X.
Mmmhh. Chatola doesn't use Athena. :) The bug you're describing is one of the major reasons for the shift away from nevow.livepage to nevow.athena. Unfortunately, there isn't an example as complex as Chatola based on Athena in the examples directory, and some of the Athena examples which are there have other problems. So the main take-away - Chatola isn't a good example of current best practices for pushing messages to a browser. Jean-Paul
That's actually very useful... maybe it would be good to say something
to this effect on the Athena page? (or maybe it already does ;)
I'll see what I can do to slap together something like chatola with
Athena. Maybe y'all will like that more than my athena tutorial
refactoring suggestion...
Cheers,
Dav
On Wed, 11 Jul 2007 22:26:24 -0400, "Jean-Paul Calderone"
Mmmhh. Chatola doesn't use Athena. :) The bug you're describing is one of the major reasons for the shift away from nevow.livepage to nevow.athena. Unfortunately, there isn't an example as complex as Chatola based on Athena in the examples directory, and some of the Athena examples which are there have other problems.
So the main take-away - Chatola isn't a good example of current best practices for pushing messages to a browser.
Jean-Paul
_______________________________________________ Twisted-web mailing list Twisted-web@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web -- Dav Clark www.eCult.org 917-544-8408
On 02:40 am, dav@securme.net wrote:
That's actually very useful... maybe it would be good to say something to this effect on the Athena page? (or maybe it already does ;)
Any updates you would like to make to the athena and nevow wiki pages would be appreciated. They are sorely in need of some maintenance, whether they mention this *particular* fact or not :).
I'll see what I can do to slap together something like chatola with Athena. Maybe y'all will like that more than my athena tutorial refactoring suggestion...
An actual, complete, simple, detailed, correct, up-to-date example of an Athena project, especially one that actually shows off its power like a chat demo, would be ***HIGHLY*** appreciated. (Maybe while you're at it you could update the athena-widget twistd plugin to be able to render more than one LivePage...)
On Thursday 12 July 2007 07:58:30 glyph@divmod.com wrote:
Any updates you would like to make to the athena and nevow wiki pages would be appreciated. They are sorely in need of some maintenance, whether they mention this *particular* fact or not :).
Glyph, I thought I'd mention that I spent a few hours yesterday and today creating a few new introductory Nevow pages on trac: http://divmod.org/trac/wiki/DivmodNevow/Tutorial http://divmod.org/trac/wiki/DivmodNevow/TutorialTwo http://divmod.org/trac/wiki/DivmodNevow/TutorialThree http://divmod.org/trac/wiki/DivmodNevow/TutorialFour http://divmod.org/trac/wiki/DivmodNevow/TutorialFive http://divmod.org/trac/wiki/DivmodNevow/TutorialSix I know the names aren't inspired, but I guess the content can always be moved later. The motivation was really that whenever I haven't done any Nevow for a while I often find that I've forgotten how to do a particular basic thing; I wanted a set of clean, small pages to get me back up to speed. I thought I might as well go the extra mile and make it simpler with complete cut-and-pasteable, runnable examples. The emphasis is therefore on working code with a quick summary of "things to note" at the bottom. One of the things I found when I was originally learning about Nevow is that the documentation tended to focus on the "Oooh! Cool Features!" aspect before the basics had even been covered. For example, the document nevow-intro.txt talks about XML on-disk templates, data/render methods, Stan, formless, webform and Athena. Now, I'm not saying that it's a worthless document; far from it: it's a valuable reference, but it doesn't live up to what it's billed as: "An introductory guide covering Nevow basics". I'd like some feedback on the style and the level at which it's pitched. I'd also like to know if there are some techniques that are plain wrong in modern Nevow. If it's generally liked, I'll try and do some more on Nevow and a few on Athena. Lastly, I've got a few questions that popped up while I was writing these pages: 1. Is it possible to have a root resource that has an overridden locateChild() method AND can render its own content? If I examine the segments for ('',) to trap the '/' URL and return self from locateChild(), then locateChild() simply gets called again and recursion sets in (in other words, self.docFactory is never examined). If I examine the segments for ('',) and return *another( page object, that is mostly satisfactory, but I still need another class definition; I found a mention somewhere that defining 'child_()' somewhere would handle the '/' resource. However, that would only work if I didn't override locateChild(), since it's locateChild() that actually does all the child lookups, in which case I'd lose the flexibility of locateChild(). 2. What is the blessed, current, best way of performing a URL redirect? I have found several methods on the ML and in the codebase and I'd like a definitive answer. Cheers, Ricky
participants (5)
-
Dav Clark
-
dav@securme.net
-
glyph@divmod.com
-
Jean-Paul Calderone
-
kgi