Hi, 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 database 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 insert all in the last step, but i don´t 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 Thanks. Bye. Juan
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 database 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 insert all in the last step, but i don´t 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 opposed 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
Hi Juan. On Mon, Feb 11, 2002 at 10:43:03AM +0100, Juan Garcia Garcia wrote:
Hi,
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 database 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 insert all in the last step, but i don´t like very much this solution. The other one is using transactions, but i don't know how to manage them.
Well, the first solution is ok most time, as you think of "remember everthing until the last step, then make all at once". Some approaches you could do this easier (and probably safer) may include using sessioning (storing the data already submitted in a session object) or encoding your collected data into one string and only using one hidden field to aggregate data. then insert everthing at once is fine. The other approach to use transactions won't work because in zope you will only be able (currently, and i think for a long time also) to have the (internal as well as external) transactions in one request. You *could* try using cursors if you want to handle the data aggregation within the database, but that's a really complicated thing when not beeing able to have it in a native transaction environment. try the first approach will be easier. :)
Anyone could help me with a suggestion or a link?
Zope 2.4.2 ZPsycopgDA 1.0 PostgreSQL 7.1.3
PG: good choice
Thanks. Bye. Juan
np. Christian. -- Christian Theune - ct@gocept.com gocept gmbh & co.kg - schalaunische strasse 6 - 06366 koethen/anhalt tel.+49 3496 3099112 - fax.+49 3496 3099118 mob. - 0178 48 33 981 reduce(lambda x,y:x+y,[chr(ord(x)^42) for x in 'zS^BED\nX_FOY\x0b'])
participants (3)
-
Christian Theune -
Juan Garcia Garcia -
Rik Hoekstra