Python in HTML files
Alex Martelli
aleax at aleax.it
Thu Apr 17 06:52:54 EDT 2003
Em wrote:
> I'm trying to get Python commands to run from within HTML files (a la
> PHP) or at least simulate that behavior.
>
> From what I've found so far it looks like I need to have a lot more
> permissions than I do. Basically I have access to a /public_html
> directory with a CGI-BIN and that's it. I can't copy any files outside
> of my /public_html directory.
>
> So my question is, do you know of any technologies like this that are
> not Servlets and do not copy files outside a locked-down user's profile?
You could have your CGI script execute any templating utility of your
choice (including the toy-level YAPTU I wrote for the Cookbook, THAT
one at least shouldn't be a problem to embed in your scripts or put
side by side with them, since it's so tiny -- 80 lines or thereabouts
once you remove the test & docs). Would that be OK...? It wouldn't
give you "request", "response", and "session" objects, though -- just
the embedding. Your CGI scripts could also use the normal cgi module
just to parse incoming HTML forms, and perhaps Cookie and e.g. shelve
to simulate some minimal session-continuity, if you need that.
But, I'm not aware of any already-integrated framework that puts these
few pieces together seamlessly and is designed to work under the strict
deployment constraints you specify -- looks like a fun project for
a free weeekend... if you have any such thing;-).
Alex
More information about the Python-list
mailing list