[Zope3-checkins] SVN: Zope3/trunk/src/zope/configuration/config.py add missing try/finally to ZCML action processing; without this the `clear`

Benji York benji at zope.com
Mon Aug 15 16:50:33 EDT 2005


Log message for revision 37947:
  add missing try/finally to ZCML action processing; without this the `clear`
  parameter would not be honored if an exception occurred while performing the
  action
  

Changed:
  U   Zope3/trunk/src/zope/configuration/config.py

-=-
Modified: Zope3/trunk/src/zope/configuration/config.py
===================================================================
--- Zope3/trunk/src/zope/configuration/config.py	2005-08-15 20:47:56 UTC (rev 37946)
+++ Zope3/trunk/src/zope/configuration/config.py	2005-08-15 20:50:03 UTC (rev 37947)
@@ -612,25 +612,26 @@
 
 
         """
-        for action in resolveConflicts(self.actions):
-            (discriminator, callable, args, kw, includepath, info, order
-             ) = expand_action(*action)
-            if callable is None:
-                continue
-            try:
-                callable(*args, **kw)
-            except:
-                if testing:
-                    raise
-                t, v = sys.exc_info()[:2]
-                v = ConfigurationExecutionError(t, v, info)
-                t = ConfigurationExecutionError
-                raise t, v, sys.exc_info()[2]
+        try:
+            for action in resolveConflicts(self.actions):
+                (discriminator, callable, args, kw, includepath, info, order
+                 ) = expand_action(*action)
+                if callable is None:
+                    continue
+                try:
+                    callable(*args, **kw)
+                except:
+                    if testing:
+                        raise
+                    t, v = sys.exc_info()[:2]
+                    v = ConfigurationExecutionError(t, v, info)
+                    t = ConfigurationExecutionError
+                    raise t, v, sys.exc_info()[2]
+        finally:
+            if clear:
+                del self.actions[:]
 
-        if clear:
-            del self.actions[:]
 
-
 class ConfigurationExecutionError(ConfigurationError):
     """An error occurred during execution of a configuration action
     """



More information about the Zope3-Checkins mailing list