[Web-SIG] Clientside Python

Sascha Peilicke sasch.pe at gmx.de
Sat Jun 23 11:37:07 CEST 2007


Hello,

Hello, hopefully this is the right place, I would like to propose a new
application area for Python. But lets start from the beginning. Python
already started to conquer the server-side via all those cool frameworks
(Django,Pylons,TurboGears,...), basically everything related to networks
is available. But one thing is missing: client-side python-scripting in
the web-browser! Think about it, there are basically only two languages
usable for this purpose, VBScript, no option. JavaScript, the status quo
but it is more a thing one has to work with and not want to work with.
Like these guys from the MochiKit framework " ... make JavaScript suck
less" and it really sucks! Wouldn't it be cool to have our favorite
language at hand when developing a web-app? 
I am not sure about how difficult this task could be. The interpreter
runs on every platform which can run a browser, it can be embedded in
basically every kind of software. The thing to do would be creating a
fully-compatible DOM-Implementation, XMLHttpRequest and some kind of
wrapping middleware which acts as the interface for the specific
browser. I tried to do some programmer's art:

-----------   --------------  ------------------------
| Browser |   | Middleware |  | Python-Interpreter   |
|         |===| (glue code)|==| DOM-Stack            |
-----------   --------------  | Reduced Standard-Lib |
                              | XMLHttpRequest       |
                              | ...                  |
                              ------------------------

Then the following will become possible then:

...
<script type="text/python">
   def compute():
   	2*3
</script>
...
<div onload="compute"></div>
...

Altough I see a slight problem: correct indentation, which is important
for python code inside <script> tags. I am sure this could be solved
somehow. Another point: License, we can't say just GPL or free licenses
in general, to become successfull it has to work in proprietary
browsers, a thing to talk about. As a last point we could implement a
unique feature, let me explain that point. Everybody knows the
XMLHttpRequest object, which made Web2.0 possible. It is cool to do
asynchronous request but only for the download direction. What about an
object which does the same for upload. Example: I want to upload a big
pdf file in my plone site. This usually takes time, lots of time. It is
possible to do this asynchronously with nasty JavaScript hacks
(toghether with an iframe..). I call it XMLHttpResponse :) 


I am looking foward to hearing from you, all the best,
Sascha Peilicke
-- 
http://saschashideout.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Dies ist ein digital signierter Nachrichtenteil
Url : http://mail.python.org/pipermail/web-sig/attachments/20070623/42d454e8/attachment.pgp 


More information about the Web-SIG mailing list