Revision: 1002
Author: sbigaret
Date: 2006-04-23 06:01:38 -0700 (Sun, 23 Apr 2006)
ViewCVS: http://svn.sourceforge.net/modeling/?rev=1002&view=rev
Log Message:
-----------
Fixed bug #1442766: ZEditingContextSessioning was incorrectly reporting an error in ZEO environments
Modified Paths:
--------------
trunk/ZModeling/CHANGES
trunk/ZModeling/ZEditingContextSessioning/__init__.py
Modified: trunk/ZModeling/CHANGES
===================================================================
--- trunk/ZModeling/CHANGES 2006-04-22 22:22:45 UTC (rev 1001)
+++ trunk/ZModeling/CHANGES 2006-04-23 13:01:38 UTC (rev 1002)
@@ -1,8 +1,16 @@
CHANGES for ZModeling
=====================
-Current release is: 0.9-pre-15
+Current release is: 0.9
+ * ZEditingContextSessioning: Fixed bug #1442766: the product was incorrectly
+ reporting an error in ZEO environments.
+
+0.9 (2006/02/26)
+----------------
+
+ * Now distributed under a 3-clause BSD-style license, see LICENSE for details
+
0.9-pre-15 (2003/09/13)
-----------------------
Modified: trunk/ZModeling/ZEditingContextSessioning/__init__.py
===================================================================
--- trunk/ZModeling/ZEditingContextSessioning/__init__.py 2006-04-22 22:22:45 UTC (rev 1001)
+++ trunk/ZModeling/ZEditingContextSessioning/__init__.py 2006-04-23 13:01:38 UTC (rev 1002)
@@ -72,6 +72,8 @@
except:
pass
+sessionDeletion_hook_path = '/Control_Panel/Products/ZEditingContextSessioning/sessionDeletion_hook'
+
def defaultEditingContext(session):
"""
Returns the EditingContext bound to 'session'
@@ -89,31 +91,47 @@
app=context._ProductContext__app
sessionDataContainer=app.temp_folder.session_data
- if sessionDataContainer.getDelNotificationTarget():
- zLOG.LOG('Products.ZEditingContextSessioning', zLOG.ERROR,
- "The session data container's destruction callback already set -- installation aborted")
- return
+ installed_deletion_hook = sessionDataContainer.getDelNotificationTarget()
+ if installed_deletion_hook:
+ if installed_deletion_hook in (sessionDeletion_hook_path,
+ sessionDeletion_hook):
+
+ zLOG.LOG('Products.ZEditingContextSessioning', zLOG.INFO,
+ "session's deletion hook already registered")
+
+ else:
+ zLOG.LOG('Products.ZEditingContextSessioning', zLOG.ERROR,
+ "The session data container's destruction callback already set -- installation aborted")
+ return
+ else:
+ ## Supply the path to the method rather than the method itself, or the
+ ## Transient Object Container's ZMI will not show a meaningful value for
+ ## its field 'Script to call when objects are deleted'
+ #sessionDataContainer.setDelNotificationTarget(sessionDeletion_hook)
+ zLOG.LOG('Products.ZEditingContextSessioning', zLOG.INFO,
+ "Registering the session's deletion hook")
+ sessionDataContainer.setDelNotificationTarget(sessionDeletion_hook_path)
+
# There is no SessionObject, just Transient Object
if getattr(TransientObject, 'defaultEditingContext', None):
- zLOG.LOG('Products.ZEditingContextSessioning', zLOG.ERROR,
- "TransientObject already has a 'defaultEditingContext' attribute -- installation aborted")
+ zLOG.LOG('Products.ZEditingContextSessioning', zLOG.INFO,
+ "TransientObject already has a 'defaultEditingContext' attribute")
+ else:
+ zLOG.LOG('Products.ZEditingContextSessioning', zLOG.INFO,
+ "Adding method 'defaultEditingContext()' to TransientObject")
+ TransientObject.defaultEditingContext=defaultEditingContext
- return
- TransientObject.defaultEditingContext=defaultEditingContext
-
- ## Supply the path to the method rather than the method itself, or the
- ## Transient Object Container's ZMI will not show a meaningful value for
- ## its field 'Script to call when objects are deleted'
- #sessionDataContainer.setDelNotificationTarget(sessionDeletion_hook)
- sessionDataContainer.setDelNotificationTarget('/Control_Panel/Products/ZEditingContextSessioning/sessionDeletion_hook')
-
product=app.Control_Panel.Products.ZEditingContextSessioning
bind_to_zope_txn='bind_saveChanges_to_zope_transactions'
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)
-
+ else:
+ zLOG.LOG('Products.ZEditingContextSessioning', zLOG.INFO,
+ "Product's Control Panel: Properties tab already initialized")
+
+
# ?? Why did I need this?
#context._ProductContext__prod.sessionDeletion_hook=sessionDeletion_hook
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|