CGI and external JavaScript nightmare

IamIan iansan at
Thu Oct 11 08:23:06 CEST 2007

My website is built from a Python CGI and works great. I'm now
including Google Ads, which requires two pieces of JavaScript; the
first contains the display settings for the ads, and the second piece
is a very lengthy garbled js file at

The first piece of JavaScript works fine and the ads display
correctly, however the second file throws an "unterminated string
literal" js error. Looking at it you can see a healthy amount of both
single and double quotes, which is where my problem lies.

What is the best way to get the second js file into a nice printable/
usable format? cgi.escape? xml.sax.saxutils.quoteattr? String
substitution? I could use some guidance.

Thank you!

More information about the Python-list mailing list