I'm trying to write a product that will use a callback/hook schema. That way a user can specify wether a DTMLMethod or a SQLMEthod should handle a paticular error. So I have an object with a function defined like this. def callback(self): """Call back test""" func = getattr(self, 'ring') return apply(func, (self, globals())) 'ring' is a document method defined in the root folder. It finds this object but when it tries to render 'ring' it can't find standard_html_header and gives me this traceback. Traceback (innermost last): File /home/sroberts/Zope/lib/python/ZPublisher/Publish.py, line 255, in publish_module File /home/sroberts/Zope/lib/python/ZPublisher/Publish.py, line 161, in publish File /home/sroberts/Zope/lib/python/ZPublisher/mapply.py, line 154, in mapply (Object: callback) File /home/sroberts/Zope/lib/python/ZPublisher/Publish.py, line 98, in call_object (Object: callback) File /home/sroberts/Zope/lib/python/Products/Wampum/WampumGenerator.py, line 83, in callback (Object: wamp) File /home/sroberts/Zope/lib/python/OFS/DTMLMethod.py, line 158, in __call__ (Object: ring) File /home/sroberts/Zope/lib/python/OFS/DTMLMethod.py, line 154, in __call__ (Object: ring) File /home/sroberts/Zope/lib/python/DocumentTemplate/DT_String.py, line 514, in __call__ (Object: ring) KeyError: standard_html_header I thought that maybe this was an aquisition problem so I tried using the __of__() call like this: return apply(func.__of__(self), (self, globals())) This gave the same error. Any thoughts? --------------------------------------------------- - Scott Robertson Phone: 714.972.2299 - - CodeIt Computing Fax: 714.972.2399 - - http://codeit.com - ---------------------------------------------------
I have a situation where an operation can be performed that may require multiple interactions with the user depending on the information that is available. Currently each interaction results in a single transaction, but I would like the entire process to be rolled up into one transaction, enabling rollback and undo to work correctly and not leave the database in an invalid state. According to the documentation, calling begin on the Transaction object will result in the active transaction being aborted. What I need is nested transactions, where calling begin only increments an internal count and subsequent commits decrement the count until 0 when the transaction is actually committed (i.e. as for most SQL databases). Sub-transactions do not help as their behaviour is the same as what occurs now. Is there a way to do this currently ? (Note that ideally this would work in both 1.10.3 and 2.0 until a stable 2.0 is released.) TIA Robert Leftwich
Robert Leftwich wrote:
I have a situation where an operation can be performed that may require multiple interactions with the user depending on the information that is available. Currently each interaction results in a single transaction, but I would like the entire process to be rolled up into one transaction, enabling rollback and undo to work correctly and not leave the database in an invalid state.
A Version can do this. In fact, Versions are long running transactions. You might have noticed the new link 'Version Managment' on the control panel about them.
According to the documentation, calling begin on the Transaction object will result in the active transaction being aborted. What I need is nested transactions, where calling begin only increments an internal count and subsequent commits decrement the count until 0 when the transaction is actually committed (i.e. as for most SQL databases). Sub-transactions do not help as their behaviour is the same as what occurs now.
Versions can contain versions, but you can only work in one at a time. This might do what your looking for. -Michel
participants (3)
-
Michel Pelletier -
Robert Leftwich -
Scott Robertson