[Zope] Get a reference to the latest transaction

Peter Bengtsson peter at fry-it.com
Tue Dec 12 09:51:45 EST 2006


Is it possible? If so, how do I get a reference to the last/current
transaction that just happened within a method?
Pseudo code:

class MyFolder(Folder):
    def manage_afterAdd(self):
           self.image_count = 0
    def addImage(self, imgdata, REQUEST):
           self.manage_addImage('someid', file=imgdata)
           self.image_count = self.image_count + 1
           url = self.absolute_url() + '?transactionid=%s' %
get_transaction().getId()
           REQUEST.RESPONSE.redirect(url)

If I had that, I could then do the following in my template:

<div tal:condition="request/transactionid|nothing">
Image uploaded.
<a tal:attributes="href
string:undoTransaction?transactionid=${request/transactionid}"
 >Undo</a>
</div>

Is it possible?

-- 
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com


More information about the Zope mailing list