[Zope3-checkins] CVS: Zope3/lib/python/Zope/Security - Checker.py:1.17

Steve Alexander steve@cat-box.net
Mon, 16 Dec 2002 08:31:25 -0500


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

Modified Files:
	Checker.py 
Log Message:
defineChecker now insists that its 'type_' argument is a type, class or
module.



=== Zope3/lib/python/Zope/Security/Checker.py 1.16 => 1.17 ===
--- Zope3/lib/python/Zope/Security/Checker.py:1.16	Fri Dec  6 09:55:43 2002
+++ Zope3/lib/python/Zope/Security/Checker.py	Mon Dec 16 08:30:55 2002
@@ -280,10 +280,12 @@
     The checker can be a Checker, or a function that, when called with
     an object, returns a Checker.
     """
+    if not isinstance(type_, (type, types.ClassType, types.ModuleType)):
+        raise TypeError(
+                'type_ must be a type, class or module, not a %s' % type_)
     if type_ in _checkers:
         raise DuplicationError(type_)
     _checkers[type_] = checker    
-    
 
 NoProxy = object()