[Zope3-checkins] SVN: Zope3/branches/ZopeX3-3.0/src/zope/security/_zope_security_checker.c Merged from /z3/jim-sidnei-debug/ branch r26106

Jim Fulton jim at zope.com
Tue Jul 6 15:17:27 EDT 2004


Log message for revision 26131:
Merged from /z3/jim-sidnei-debug/ branch r26106

Raise an exception if the value of __Security_checker__ is None



-=-
Modified: Zope3/branches/ZopeX3-3.0/src/zope/security/_zope_security_checker.c
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/security/_zope_security_checker.c	2004-07-06 19:12:57 UTC (rev 26130)
+++ Zope3/branches/ZopeX3-3.0/src/zope/security/_zope_security_checker.c	2004-07-06 19:17:27 UTC (rev 26131)
@@ -229,11 +229,6 @@
 /*         checker = getattr(value, '__Security_checker__', None) */
   checker = PyObject_GetAttr(value, str___Security_checker__);
 /*         if checker is None: */
-  if (checker == Py_None)
-    {
-      Py_DECREF(checker);
-      checker = NULL;
-    }
   if (checker == NULL)
     {
       PyErr_Clear();
@@ -252,6 +247,20 @@
           return value;
         }
     }
+  else if (checker == Py_None)
+    {
+      PyObject *errv = Py_BuildValue("sO",
+                                     "Invalid value, None. "
+                                     "for security checker",
+                                     value);
+      if (errv != NULL)
+        {
+          PyErr_SetObject(PyExc_ValueError, errv);
+          Py_DECREF(errv);
+        }
+      
+      return NULL;
+    }
     
   r = PyObject_CallFunctionObjArgs(Proxy, value, checker, NULL);
   Py_DECREF(checker);



More information about the Zope3-Checkins mailing list