[Zope-dev] Undo product stops working with recent Zope (StorageTransactionError)
lists at nidelven-it.no
lists at nidelven-it.no
Tue Jan 24 13:14:47 UTC 2012
Hi,
I have a product that patches Zope so that the Undo
screen also accepts a date and time for when to roll
back to (on pypi as Products.Undoer).
It used to work, but with the most recent versions of
Zope this error appears if the Undo by date is used
more than once:
2012-01-24 13:45:32 ERROR Zope.SiteErrorLog 1327409132.230.397033237621
http://localhost:8080/Plone/undo_changes_by_date
Traceback (innermost last):
Module ZPublisher.Publish, line 134, in publish
Module Zope2.App.startup, line 301, in commit
Module transaction._manager, line 89, in commit
Module transaction._transaction, line 329, in commit
Module transaction._transaction, line 441, in _commitResources
Module ZODB.DB, line 990, in tpc_begin
Module ZEO.ClientStorage, line 1116, in tpc_begin
StorageTransactionError: Duplicate tpc_begin calls for same transaction
The code looks like this:
def undo_changes_by_date(self, date=None, REQUEST=None):
"""Undoes changes made to the database after a given date; if
a date is not specified, all changes are undone."""
if date is None:
date = float(0)
elif type(date) == types.StringType:
date = float(DateTime(date))
else:
date = float(date)
transactions = self._p_jar.db().undoLog(0, 2**32)
undo=self._p_jar.db().undo
count = 0
for transaction in transactions:
if transaction['time'] >= date:
undo(transaction['id'])
count += 1
if REQUEST:
return MessageDialog(
title='Result of undoing transactions',
message="<em>%s</em> transactions were undone" % count,
action='./manage_UndoForm'
)
return count
Any ideas? Do I need to do a tpc_begin myself?
-Morten
More information about the Zope-Dev
mailing list