[Zope-Checkins] CVS: Zope/lib/python/AccessControl - Implementation.py:1.4

Brian Lloyd brian at zope.com
Thu Jan 29 14:23:08 EST 2004


Update of /cvs-repository/Zope/lib/python/AccessControl
In directory cvs.zope.org:/tmp/cvs-serv29595/lib/python/AccessControl

Modified Files:
	Implementation.py 
Log Message:
fix & document setImplementation semantics


=== Zope/lib/python/AccessControl/Implementation.py 1.3 => 1.4 ===
--- Zope/lib/python/AccessControl/Implementation.py:1.3	Fri Jan 16 13:49:22 2004
+++ Zope/lib/python/AccessControl/Implementation.py	Thu Jan 29 14:22:37 2004
@@ -31,12 +31,18 @@
 
 
 def setImplementation(name):
-    """Select the policy implementation to use.
-
-    'name' must be either 'PYTHON' or 'C'.
+    """Select the policy implementation to use. The 'name' must be either
+       'PYTHON' or 'C'. NOTE: this function is intended to be called
+       exactly once, so that the Zope config file can dictate the policy
+       implementation to be used. Subsequent calls to this function will
+       have no effect!!
     """
     import sys
     global _implementation_name
+    global _implementation_set
+
+    if _implementation_set:
+        return
 
     name = name.upper()
     if name == _implementation_name:
@@ -57,8 +63,10 @@
         if hasattr(mod, "initialize"):
             mod.initialize(impl)
 
+    _implementation_set = 1
 
 _implementation_name = None
+_implementation_set = 0
 
 _policy_names = {
     "AccessControl": ("setDefaultBehaviors",




More information about the Zope-Checkins mailing list