[Twisted-web] Connecting to external JavaScript libs with Athena

Travis Branham tbranham at gmail.com
Mon Jun 2 00:10:41 EDT 2008


Hi all,

So, I've been racking my brain for a couple of days on this, and I can't
seem to get anywhere. My question is: Is it possible to connect to an
external JavaScript library, and subsequently make calls to said library
through an Athena LivePage element?

Just to let you know where this is going, I had planned on embedding a map
in my web application, using the Google Maps API. The problem, as I'm sure
you can guess, is that the JavaScript for GM is loaded directly from their
servers through the Google AJAX API. Now, I know their Ajax API does create
a unique namespace for the function calls (eg: google.maps.Map2, etc.), but,
so far, I have been unable to get a method from a LivePage or LiveElement to
be able to talk with the Google API. Just to be clear, I have no problem
simply importing the GM API and displaying the map -- my problem is that I
want to add markers to the map, based on some server-side events.
Effectively, I will have little to no client -> server communication during
a normal visit (except, of course, the user's interaction with the map,
which happens on Google's end anyway).

When I tried to figure out how to do this in the first place, I tried
modifying the "Athena LiveElement Tutorial" by embedding the JavaScript call
(a simple "echo" function) directly into the HTML source (instead of using
the jsClass attribute in LiveElement); from there, I tried a number of ways
to get the LiveElement to "talk" to the embedded JS. No dice.

Perhaps I'm missing something, or perhaps what I'm trying to do is just not
supported. I'd supply some code here, but I really don't know if that would
be very useful; let me know, however, if you feel otherwise.

Anyway, any insight will be helpful.

Thanks a lot,
Travis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-web/attachments/20080602/5e=
5f165d/attachment.htm


More information about the Twisted-web mailing list