[Zope] Persistent form variables
Jim Washington
jwashin@vt.edu
Thu, 01 Nov 2001 11:37:21 -0500
Steven Sartorius wrote:
> Let me preface this by saying I'm a Zope newbie.....
>
> I've started to build a simple site with Zope but am at a crossroads. The
> initial page of the site is a form that would be filled in by a new visitor;
> someone who's been to the site before would see the data that they had last
> input. I don't want to use cookies, not everyone turns them on. Obviously
> some kind of data persistence is called for on the server side. My question
> is: is there an easy, idiomatic Zope way of doing this? Culling through
> the documentation ('The Zope Book', various How-To's) I've seen plenty of
> examples of creating persistent data with ZODB but all these examples focus
> on using ZODB outside the Zope framework. I guess I could write a
> Script/External Method to: 1) check for the existence of a database file; 2)
> create it if it doesn't exist; 3) check for the existence of user data; 4)
> display the data if exists; 5) display a blank form if there's no data for a
> user...etc, etc, etc.
>
> Is there an easier way to do this? A Product I don't know about or an
> elegant Zope trick? Any and all help appreciated....
>
Two ways to do this:
1. Membership, in which individuals login (userid and password) and
their personal or other data is stored and identified by their userid.
Look in the various userFolder products for something like this. I
recommend exUserfolder, though I understand CMF does similar things.
2. Session tracking, in which individuals are identified by a
generated ID, and the data are stored on the server between forms using
that ID as a key. For persistence across sessions (after the user
closes the browser), you need to store a cookie on the user's machine.
Think "shopping cart". Core Session Tracking does this.
What you seem to want to do is like session tracking, but if you cannot
live with cookies, you may need to go with membership.
-- Jim Washington