Benutzer-Werkzeuge

Webseiten-Werkzeuge


python:grok_and_zope.app.undo

Dies ist eine alte Version des Dokuments!


What: undo transactions in grok

Problem: zope.app.undo does not work with ZODB-3.10 and grok-1.10.3

Solutions (all these are workarounds, use them at your own risk):

1. MenuItem Error

as result of adding zope.app.undo to setup.py following error appears:

ConfigurationError: ('Unknown directive', u'http://namespaces.zope.org/browser', u'menuItem')

edit

zope.app.undo-3.5.0-py2.7.egg/zope/app/undo/configure.zcml

and delete the menuItem-Sections; menuItem is used bei ZMI and implemented bei zc.forms or other but not by zope.formlib; I use zope.formlib in grok apps

2. ZODB has changed the api

Error after submit the transaction ID's:

"Duplicate tpc_begin calls for same transaction"

The undo API has changed with ZODB 3.10. As noted in the changelog:

      
      "The API for undoing multiple transactions has changed. To undo
      multiple transactions in a single transaction, pass a list of
      transaction identifiers to a database's undoMultiple method. Calling a
      database's undo method multiple times in the same transaction now
      raises an exception."
      
      Your code calls undo multiple times, and needs to be changed accordingly.

edit in

zope.app.undo-3.5.0-py2.7.egg/zope/app/undo/__init__.py

the last def:

old:

    def _undo(self, ids):
 
        for id in ids:
            self.__db.undo(id)
        transaction.get().setExtendedInfo('undo', True)

new:

    def _undo(self, ids):
 
        self.__db.undoMultiple(ids)
        transaction.get().setExtendedInfo('undo', True)
python/grok_and_zope.app.undo.1347451359.txt.gz · Zuletzt geändert: 2024/08/07 13:35 (Externe Bearbeitung)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki