[Zope] Script (python) shows transaction for adding folder

Tim Hicks timNOT_THIS@sitefusion.co.uk
Sat, 12 Jan 2002 21:26:37 -0000


> Tim Hicks writes:
>  > ... Script performs actions on folder ...
>  > The transaction refers to adding a folder (and probably another one to
add
>  > the actual image) to the zodb for the upload.  So, my question is, why
does
>  > the transaction appear in the undo list for the script, and not the
parent
>  > folder I'm adding to (which is a BTree folder if that makes any
difference)?
> Strange:
>
>   I would expect that you get only a single transaction - for the
>   script, because there is just one transaction per request.

Sorry, that was me making assumptions.  The script creates a folder (if
necessary), then deposits an ExtImage into if there has been one uploaded.
In my tests, there was no uploaded file, so only the folder was created.  I
saw a transaction for this, and *assumed* I would see one for the file
upload as well if there were one present.

>   I would further expect that the transaction machinery is not
>   intelligent enough to assiciate the transaction with the
>   correct object in all cases. E.g. a single Script
>   can change many objects all over the site.

OK, I think I understand a bit better now.  Given the 'one transaction per
request' that you mention, it makes sense that the transaction (that could
have affected multiple objects) be associated with the script.  This is
mildly annoying as it will probably make the undo list huge for the script,
which will probably drown a the actual changes to the script that I may make
periodically.

Aah well, such is life.

thanks

tim