----- Original Message -----
From: "Peter Bengtsson" <[EMAIL PROTECTED]>
To: "Zope Generic List" <[email protected]>
Sent: Tuesday, December 12, 2006 9:51 AM
Subject: [Zope] Get a reference to the latest transaction
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?
You could have a look at manage_UndoForm and see how it gets the transaction
information.
Jonathan
_______________________________________________
Zope maillist - [email protected]
http://mail.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )