Hi, all. I have a trouble with Zope when I want to store a lot of the files into the ZODB in the loop. My ExternalMethod does something like: ---------8<-------------- for foo in session[files].keys(): fileData, fileName = session[files][foo] self.somewhere.manage_addFoo('foo', fileData) self.SQLMethod_to_mark_the_uploaded_file(fileName) ---------8<-------------- And browser waits, waits, waits, waits (not user-friendly, BTW!) and then tells me "ZODB.POSException.ConflictError" and my files was NOT uploaded AT ALL. Then I *had* only one idea to make semaphore via session. I.e.: Create a DTML Method, where is a text "Please wait" and <meta EQUIV-.../> with refresh to check the flag in the session. And my External Method does (algorhythm): 1. set a flag into the session, like: session['foo'] = '1' 2. Put the files in loop by "manage_addFoo(...)" 3. Remove the flag after the loop, like: del session['foo'] ...and then my DTML Method will see no flag and redirect to the normal page. But it does not work at all :-) Seems that ZOPE requires to roll over ZODB transaction, because even I set the flags, they does not change untill loop ends (I've checked it by the parallel process). Maybe I should somehow do the explicit commit() or so? :/ The howto here http://www.zope.org/Members/don/long_procces does not work. Have anybody at least _any_ idea (good, bad, i.e. *any*) how to do upload that <...> files? -- Regards, Bogdan Linux -- the OS for the Renaissance Man
Bo M. Maryniuck wrote at 2003-3-20 21:38 +0200:
... mass importing many files ...
I fear, you must call intermittent "get_transaction().commit()" to commit, to reduce the danger of ConflictError's. You should be aware, that this is no guarantee that the "commit" does not raise a conflict error. In this case, you should abort the transaction and then retry the upload for the failed file (do not forget to reset the file to its start). You may also see "ReadConflictError"s outside of the "commit". Here again, abort the transaction and retry for the failed file. Dieter
participants (2)
-
Bo M. Maryniuck -
Dieter Maurer