[Twisted-web] Chatola broken / bug in Athena?

Dav Clark dav at securme.net
Wed Jul 11 22:13:15 EDT 2007

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, )))


             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

Dav Clark

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-web/attachments/20070711/6ca85dd5/attachment.htm

More information about the Twisted-web mailing list