PDA

View Full Version : [SOLVED] HTML with Python script



DamjanDimitrioski
October 13th, 2007, 05:27 PM
I was wondering if I can use python scripts like java scripts, in xhtml page?

Smygis
October 13th, 2007, 05:42 PM
Nope. You cant.

DamjanDimitrioski
October 13th, 2007, 05:47 PM
What other scripting languages for xhtml, other then php, java, asp, are there in the world?

DamjanDimitrioski
October 13th, 2007, 05:49 PM
Also I can't understand this beans system, how it works?
Give me link

Smygis
October 13th, 2007, 06:29 PM
What other scripting languages for xhtml, other then php, java, asp, are there in the world?

As far as i know, Only JavaScript.

ASP, Java, PHP, Ruby (on Rails), Python, Perl and so on all work on the server side of things. ;)

DamjanDimitrioski
October 13th, 2007, 06:36 PM
That was what I needed, thanks.

pmasiar
October 14th, 2007, 09:06 PM
There is one neat templating system, kid, which allows you to use python (and template-side functions) in XML to generate HTML. But as previous poster said, only javascript runs in your browser.

If you do web apps, you are much better off (after trying it to do it by hand, and struggling a lot or failing) to use established web app framework. Django is "pronounced" by Guido as official, and has plenty of support and docs, but I like Turbogears more, because it is more flexible.

Why you neeed to run Python in browser? To validate input?

There is one "small" (so i mean, BIG and ugly) problem with running any javascript for validating user's input by javascript on client (browser): you cannot trust user, so you need to do exactly same validation on server again, and because you don't code server in javascript, you have to do it in different language. So if you ever seen opened can of worms, you know this is it.

There is one interesting AJAX library, ZK, which runs javascript in browser and reports all events back to the server, which can process them (in Java) by exactly came classes which will be used later to validate use's input, and passes results back to client. Very neat!