AJAX => APAX? Or: is there support for python in browsers?

R

Roger Erens

Hello,

I remember that the first time I read about Python as a programming
language was when reading the W3C's HTML 4.01 specification a few years
ago. In the section on objects, images and applets
(http://www.w3.org/TR/html401/struct/objects.html) an example was given
like

<P><OBJECT classid="http://www.miamachina.it/analogclock.py">
<PARAM name="height" value="40" valuetype="data">
<PARAM name="width" value="40" valuetype="data">
This user agent cannot render Python applications.
</OBJECT>

It's also in the XHTML2.0 specification. Now, is this just a theoretical
example? Or is there a browser that _does_ support python scripts? Or do
we have to place our bets on the Mozilla 1.9 milestone with hard work
being done by Mark Hammond?

I'm asking because of all the AJAX hype going on. I'd like rather not
delve too deep into JavaScript and use Python instead.

Any insights to be shared?

Cheers,
Roger
 
L

Larry Bates

Roger said:
Hello,

I remember that the first time I read about Python as a programming
language was when reading the W3C's HTML 4.01 specification a few years
ago. In the section on objects, images and applets
(http://www.w3.org/TR/html401/struct/objects.html) an example was given
like

<P><OBJECT classid="http://www.miamachina.it/analogclock.py">
<PARAM name="height" value="40" valuetype="data">
<PARAM name="width" value="40" valuetype="data">
This user agent cannot render Python applications.
</OBJECT>

It's also in the XHTML2.0 specification. Now, is this just a theoretical
example? Or is there a browser that _does_ support python scripts? Or do
we have to place our bets on the Mozilla 1.9 milestone with hard work
being done by Mark Hammond?

I'm asking because of all the AJAX hype going on. I'd like rather not
delve too deep into JavaScript and use Python instead.

Any insights to be shared?

Cheers,
Roger

Take a look at this kit:

http://www.mochikit.com/

It seems that this is a python programmer that has created JavaScript
functions that "feel" a lot like Python. May just be a transitional
way to go, but I thought it was interesting anyway.

-Larry Bates
 
L

Larry Bates

Roger said:
Hello,

I remember that the first time I read about Python as a programming
language was when reading the W3C's HTML 4.01 specification a few years
ago. In the section on objects, images and applets
(http://www.w3.org/TR/html401/struct/objects.html) an example was given
like

<P><OBJECT classid="http://www.miamachina.it/analogclock.py">
<PARAM name="height" value="40" valuetype="data">
<PARAM name="width" value="40" valuetype="data">
This user agent cannot render Python applications.
</OBJECT>

It's also in the XHTML2.0 specification. Now, is this just a theoretical
example? Or is there a browser that _does_ support python scripts? Or do
we have to place our bets on the Mozilla 1.9 milestone with hard work
being done by Mark Hammond?

I'm asking because of all the AJAX hype going on. I'd like rather not
delve too deep into JavaScript and use Python instead.

Any insights to be shared?

Cheers,
Roger

Take a look at this kit:

http://www.mochikit.com/

It seems that this is a python programmer that has created JavaScript
functions that "feel" a lot like Python. May just be a transitional
way to go, but I thought it was interesting anyway.

-Larry Bates
 
S

Stephen Prinster

Roger said:
I'm asking because of all the AJAX hype going on. I'd like rather not
delve too deep into JavaScript and use Python instead.

Any insights to be shared?

Cheers,
Roger

In addition to the others already mentioned, you might want to check out
Nevow. Quoting from the website:

"Finally, Nevow includes LivePage, a two-way bridge between Javascript
in a browser and Python on the server. LivePage is compatible with
Mozilla, Firefox, Windows Internet Explorer 6, and Safari on Mac OS X.
Event handlers can be written in pure Python and Javascript
implementation details are hidden from the programmer, with Nevow taking
care of routing data to and from the server using XmlHttpRequest."

http://divmod.org/trac/wiki/DivmodNevow


Steve P.
 
T

Tim Roberts

Roger Erens said:
I remember that the first time I read about Python as a programming
language was when reading the W3C's HTML 4.01 specification a few years
ago. In the section on objects, images and applets
(http://www.w3.org/TR/html401/struct/objects.html) an example was given
like

<P><OBJECT classid="http://www.miamachina.it/analogclock.py">
<PARAM name="height" value="40" valuetype="data">
<PARAM name="width" value="40" valuetype="data">
This user agent cannot render Python applications.
</OBJECT>

It's also in the XHTML2.0 specification. Now, is this just a theoretical
example? Or is there a browser that _does_ support python scripts? Or do
we have to place our bets on the Mozilla 1.9 milestone with hard work
being done by Mark Hammond?

Internet Explorer will allow any registered ActiveScript language to be
used in a web page. Python qualifies. In the latest Win32 extensions,
there is a script in win32comext/axscript/client/pyscript.py that will
register Python as an ActiveScript language.

The you can say

<script language="python">
print "<h1>Hello, there.</h1>"
</script>
 
A

Alex Martelli

Tim Roberts said:
Internet Explorer will allow any registered ActiveScript language to be
used in a web page. Python qualifies. In the latest Win32 extensions,
there is a script in win32comext/axscript/client/pyscript.py that will
register Python as an ActiveScript language.

The you can say

<script language="python">
print "<h1>Hello, there.</h1>"
</script>

Out of curiosity, how "sandboxed" is this Python? I remember a similar
solution being withdrawn once because it wasn't really safely sandboxed,
so the ``script'' could easily do any arbitrary damage to the machine...


Alex
 
M

Michael Schneider

Alex,

Good point. Can python be used to write firefox extensions that could
be called from javascript?

1) javascript would come in on the HTML page
2) javascript would communication with the Extension API
3) the extension would be written in python

That way, you would only need to make your extension's API safe to the wild.

It would require the user to download an extension, but flash, et all
seem to do ok.

Is this possible today?

Thanks
Mike


PS. Sorry for my ignorance on this, I am a client-side developer,
trying to explore serious client development.
 
T

Tim Roberts

Out of curiosity, how "sandboxed" is this Python? I remember a similar
solution being withdrawn once because it wasn't really safely sandboxed,
so the ``script'' could easily do any arbitrary damage to the machine...

I remember this as well. I thought the holes were largely plugged, but I
admit to losing track of the discussion. Is Mark Hammond in the viewing
audience?

One of the compromises is that the pywin32 installer does not perform this
registration automatically. The script is present, but you have to run the
registration script yourself.
 

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top