[Zope] Preserving Settings during a user's session

Christopher G. Petrilli petrilli@amber.org
Wed, 24 Feb 1999 10:16:26 -0500


On Tue, Feb 23, 1999 at 10:16:27PM -0800, Jeff Nielsen wrote:
> I need to preserve variables, like State=CA or ID=5, throughout a user's
> session, unless I specifically change them in a page (i.e. I change ID=5 to
> ID=4).
> 
> Anybody got a better idea?

Another option, one I've used a lot because it keeps things "clean", is
to use HIDDEN fields in forms.  Now this only works if someone clicks a
"submit" button to go somewhere ,though... 

The other option, BTW, is to do something even funkier (a'la WebObjects)
and create a session ID that is some huge number (let's pick 42 for this
example :-) and you append it on (or insert it somewhere) to the whole
thing:

	http://www.megacorp.com/foo/bar/user/42

What I like better honestly is this:

	http://www.megacorp.com/42/foo/bar/user

What this would let you do is have the (flash of insight) ZPublisher
insert the ID into the REQUEST object on the fly so that you could have
access to it wherever you want, then rewrite the request to its more
traditional form, following that path.  This would require banning
"numbers" as root folders, but seems reasonable.  So onward and upward
in idealogy (I've been thinking about this for a while, actually):

* ID is hex signature of IP address and initial timestamp (a'la UNIX)
passed through an MD5 filter.  THis only needs to be one-way in my
opinion, and for privacy, shouldn't go backwards.

* You can pull this farther into "Session Objects" which can be
persistent across visits (by using something else besides IP to look
them up) and can contain any amount of information that the application
needs.

* Move one step further: Session Server, this could be shared among
multiple Zope servers to allow perfect load-balancing,failover, etc.

Wa'la... all that handwaving and it's done, eh?  Now, honestly, I
haven't a clue as to how to cram that into the ZPublisher, since i've
not looked at the internals too much, but I trust the gang at DC to have
done things "right" the first time :-)

Chris
-- 
| Christopher Petrilli                      ``Television is bubble-gum for
| petrilli@amber.org                          the mind.''-Frank Lloyd Wright