Persistent python object and the Web

ramon.aragues at gmail.com ramon.aragues at gmail.com
Thu Apr 21 14:15:02 EDT 2005


Hi,

I'd like to know if I am trying to do something impossible or I am just
being unable to find how to do it. In the latter case, please... help
me...

I´ve implemented a python class Graph, which handles graphs (with its
nodes, edges, finding paths, etc). In my text-menu interface, I can add
nodes, delete nodes, add edges, find shortest routes, etc. I simply
create a graph_object before presenting the text menu and then, when a
user choses a command (eg. add-node) I call the method of this object
with the appropiate parameters.

Now... I need to "translate" this text-menu interface  to a web
interface. The same as the text-menu interface, but letting the user do
it through the web. I have created an HTML that lets the user enter the
parameters and chose which command to execute by pushing different
buttons. But...

My problem is that I don't know how to create a graph_object that
remains persistent through time (it has to be the same graph_object for
the first command as for the last one "pushed" by the user). I want to
be able to create the object when the user enters the web page (by
calling graph_object = Graph(id="graph1")) and then make calls to
graph_object methods when the user pushes a button.

I'm using python2.3, mod_python and Apache.

Any help will be greatly appreaciated.

Ramon




More information about the Python-list mailing list