[Zope] Postponing insertion in database

Rik Hoekstra rik.hoekstra@inghist.nl
Mon, 11 Feb 2002 11:23:14 +0100


 >
 >   my problem is that i have three consecutive forms: when i click the
 > submit button of the first one, i insert in the database and then
 > redirect to the second form, and the same with the second and third.
 > But the three insertions must be completed if i want to have a databas=
e
 > not corrupted. If the user stops in the second form, for example by
 > closing the navigator, the previous insertion must be undone.
 >
 > I thought two solutions, the first one is using hidden inputs and inse=
rt
 > all in the last step, but i don=B4t like very much this solution. The
 > other one is using transactions, but i don't know how to manage them.
 >
 > Anyone could help me with a suggestion or a link?
 >
 > Zope 2.4.2
 > ZPsycopgDA 1.0
 > PostgreSQL 7.1.3
 >

you could also consider using a transient or volatile (temporary as oppos=
ed to
persistent) object, a ZClass for instance, for this purpose:  give it the
properties that correspond to the values you want to enter. It will stay =
in
memory, but is not stored in the ZODB. After the transaction is completed=
, write
to the database and delete the object.

Another possibilty is to use sessions for this and store the values into =
session
variables.

hth

Rik