Re: patch that makes saveChanges optional on session destruction in zope
John Lenton <[email protected]> Fri, 18 Jun 2004 13:19:17 -0300
| Newsgroups | gmane.comp.python.modeling |
|---|---|
| Message-ID | <[email protected]> |
and now, the patch. -- John Lenton ([email protected]) -- Random fortune: Siempre que te pregunten si puedes hacer un trabajo, contesta que si y ponte enseguida a aprender como se hace. -- Franklin Delano Roosevelt.
saveChangesMaybe.patch
(text/plain, 1003 B)
--- __init__.py~ 2004-06-07 22:58:27.000000000 -0300
+++ __init__.py 2004-06-18 12:38:11.000000000 -0300
@@ -46,9 +46,11 @@
pass
def _finish(self):
- self.ec.lock()
- self.ec.saveChanges()
- self.ec.unlock()
+ product=session.Control_Panel.Products.ZEditingContextSessioning
+ if product.saveChanges_on_destroy:
+ self.ec.lock()
+ self.ec.saveChanges()
+ self.ec.unlock()
def _begin(self):
pass
@@ -124,6 +126,10 @@
if bind_to_zope_txn not in [p['id'] for p in product._properties]:
product.manage_addProperty(id=bind_to_zope_txn,
type='boolean', value=0)
+ save_changes_on_destroy='saveChanges_on_destroy'
+ if save_changes_on_destroy not in [p['id'] for p in product._properties]:
+ product.manage_addProperty(id=save_changes_on_destroy,
+ type='boolean', value=1)
# ?? Why did I need this?
#context._ProductContext__prod.sessionDeletion_hook=sessionDeletion_hook