How can I pass objects in a web page?

B

Brian Bull

I have written something that creates about 5000 unique objects. I
want to have a link on a page that when clicked will take the user to
a page that will "describe" the contents of the object. The problem
seems to be passing the object from one static page to another via a
link. Is this possible?
 
C

Cliff Wells

I have written something that creates about 5000 unique objects. I
want to have a link on a page that when clicked will take the user to
a page that will "describe" the contents of the object. The problem
seems to be passing the object from one static page to another via a
link. Is this possible?

The web, being stateless, usually requires that you "rebuild the world"
with every mouse click. Probably what you'd want to do is use some sort
of persistent object store (usually a database) to recover your objects
from. I know there are a few projects that make this at least semi-
transparent, ZODB being one of the more commonly used ones (it's part of
Zope but can be used separately, if I'm not mistaken). Try googling for
python+persistent+objects and see what comes up.

Regards,
Cliff
 
D

drs

* * *
The web, being stateless, usually requires that you "rebuild the world"
with every mouse click.

Depending upon what the objects are like, python provides the pickle module
which allows for doing this without setting up a database. Simply have the
first page embed a pickled object in a hidden input html tag that is sent
back to the server for the object inspection screen. Not secure of course,
and conceivably very slow for large objects*, but pretty easy to do.

-d

* for large objects, dump them to a file on the server and return some
unique id instead of the whole object.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,206
Messages
2,571,069
Members
47,678
Latest member
Aniruddha Das

Latest Threads

Top