[Zope3-checkins] SVN: Zope3/branches/jim-sidnei-debug/src/zope/security/_zope_security_checker.c Raise an exception if the value of __Security_checker__ is None

Jim Fulton jim at zope.com
Tue Jul 6 09:54:42 EDT 2004


Log message for revision 26106:
Raise an exception if the value of __Security_checker__ is None



-=-
Modified: Zope3/branches/jim-sidnei-debug/src/zope/security/_zope_security_checker.c
===================================================================
--- Zope3/branches/jim-sidnei-debug/src/zope/security/_zope_security_checker.c	2004-07-06 13:42:26 UTC (rev 26105)
+++ Zope3/branches/jim-sidnei-debug/src/zope/security/_zope_security_checker.c	2004-07-06 13:54:42 UTC (rev 26106)
@@ -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