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
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))
        date = float(date)
    transactions = self._p_jar.db().undoLog(0, 2**32)
    count = 0
    for transaction in transactions:
        if transaction['time'] >= date:
            count += 1
    if REQUEST:
        return MessageDialog(
                title='Result of undoing transactions',
                message="<em>%s</em> transactions were undone" % count,
    return count

Any ideas?  Do I need to do a tpc_begin myself?


Zope-Dev maillist  -  Zope-Dev@zope.org
**  No cross posts or HTML encoding!  **
(Related lists -
 https://mail.zope.org/mailman/listinfo/zope )

Reply via email to