[ZODB-Dev] Trouble with 'transaction' module

Andreas Jung lists at andreas-jung.com
Tue Jan 31 09:27:21 EST 2006


Hi,

I have the following code in side a Plone app. The intent of this method is 
to perform a logging of changed Archetype fields. This code basically works 
but under some unknown circumstances I get error below where the 
transaction module seems to be None?!  There is no product refreshing 
enabled. I am using Zope 2.8.5....any ideas?

Andreas

--------


import transaction

def post_validate(self, REQUEST, errors):
    """ hook into AT(CT) to intercept edit operations to provide
        logging for changed data.
    """

    T = transaction.get()
    CH = CommitHandler()
    CH.setInstance(self)
    T.beforeCommitHook(CH)

    return self._post_validate(REQUEST, errors)


--------

 File 
"/develop/sandboxes/plone2.1/Zope/lib/python/Shared/DC/Scripts/Bindings.py", 
line 311, in __call__
    return self._bindAndExec(args, kw, None)
  File 
"/develop/sandboxes/plone2.1/Zope/lib/python/Shared/DC/Scripts/Bindings.py", 
line 348, in _bindAndExec
    return self._exec(bound_data, args, kw)
  File 
"/develop/sandboxes/plone2.1/instance/Products/CMFCore/FSPythonScript.py", 
line 163, in _exec
    result = f(*args, **kw)
  File "Script (Python)", line 23, in validate_atct
  File 
"/develop/sandboxes/plone2.1/instance/Products/Archetypes/BaseObject.py", 
line 504, in validate
    self.post_validate(REQUEST, errors)
  File 
"/develop/sandboxes/plone2.1/instance/Products/SRMedia/monkeypatches.py", 
line 72, in post_validate
    return self._post_validate(REQUEST, errors)
  File 
"/develop/sandboxes/plone2.1/instance/Products/SRMedia/monkeypatches.py", 
line 67, in post_validate
    T = transaction.get()
AttributeError: 'NoneType' object has no attribute 'get'
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zodb-dev/attachments/20060131/9ae71785/attachment-0001.bin


More information about the ZODB-Dev mailing list