[Zope-Checkins] CVS: Zope3/lib/python/Zope/Configuration - xmlconfig.py:1.1.2.15.8.5

Jim Fulton jim@zope.com
Tue, 4 Jun 2002 12:43:19 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/Configuration
In directory cvs.zope.org:/tmp/cvs-serv7653/lib/python/Zope/Configuration

Modified Files:
      Tag: Zope3InWonderland-branch
	xmlconfig.py 
Log Message:
Added permission attribute for service directives. This lets you set
security within the service directive itself.

Added a __Security_checker__ attribute, checked by the ProxyFactory
that specifies a checker to be used for proxies. This allows us to
record the permission requirements on a component without actually
creating a proxy. If this attribute can't be set, we'll go ahead and
create the proxy anyway.




=== Zope3/lib/python/Zope/Configuration/xmlconfig.py 1.1.2.15.8.4 => 1.1.2.15.8.5 ===
     "Zope XML Configuration error"
 
-    def __init__(self, locator, mess):
-        if not isinstance(mess, StringType):
-            try:
-                mess = "\n%s: %s" % (mess.__class__.__name__, mess)
-            except AttributeError:
-                mess = str(mess)
+    def __init__(self, locator, mess, etype=None):
+        if etype is None:
+            if not isinstance(mess, StringType):
+                try:
+                    mess = "\n%s: %s" % (mess.__class__.__name__, mess)
+                except AttributeError:
+                    mess = str(mess)
+        else:
+            mess = "\n%s: %s" % (etype.__name__, mess)
+            
         self.lno = locator.getLineNumber()
         self.cno = locator.getColumnNumber()
         self.sid = locator.getSystemId()
@@ -49,12 +53,16 @@
     """An error occurred during execution of a configuration action
     """
 
-    def __init__(self, locator, mess):
-        if isinstance(mess, StringType):
-            try:
-                mess = "%s: %s" % (mess.__class__.__name__, mess)
-            except AttributeError:
-                mess = str(mess)
+    def __init__(self, locator, mess, etype=None):
+        if etype is None:
+            if isinstance(mess, StringType):
+                try:
+                    mess = "%s: %s" % (mess.__class__.__name__, mess)
+                except AttributeError:
+                    mess = str(mess)
+        else:
+            mess = "\n%s: %s" % (etype.__name__, mess)
+
         self.lno, self.cno, self.sid = locator
         self.mess = mess
 
@@ -324,4 +332,5 @@
                 callable, args, kw = f
                 callable(*args, **kw)
             except Exception, v:
-                raise ConfigurationExecutionError(loc, v)
+                raise ConfigurationExecutionError, (
+                    loc, v, sys.exc_info()[0]), sys.exc_info()[2]