[Checkins] SVN: Zope3/trunk/src/zope/interface/declarations.py Fix small bug.

Gary Poster gary at zope.com
Fri Apr 28 20:44:11 EDT 2006


Log message for revision 67745:
  Fix small bug.
  

Changed:
  U   Zope3/trunk/src/zope/interface/declarations.py

-=-
Modified: Zope3/trunk/src/zope/interface/declarations.py
===================================================================
--- Zope3/trunk/src/zope/interface/declarations.py	2006-04-29 00:33:49 UTC (rev 67744)
+++ Zope3/trunk/src/zope/interface/declarations.py	2006-04-29 00:44:10 UTC (rev 67745)
@@ -1105,13 +1105,21 @@
         ['IFooFactory']
         >>> [i.getName() for i in C().__providedBy__]
         ['IFoo']
+
+      If classProvides is called outside of a class definition, it fails.
+
+        >>> classProvides(IFooFactory)
+        Traceback (most recent call last):
+        ...
+        TypeError: classProvides can be used only from a class definition.
+
       """
     frame = sys._getframe(1)
     locals = frame.f_locals
 
     # Try to make sure we were called from a class def
     if (locals is frame.f_globals) or ('__module__' not in locals):
-        raise TypeError(name+" can be used only from a class definition.")
+        raise TypeError("classProvides can be used only from a class definition.")
 
     if '__provides__' in locals:
         raise TypeError(



More information about the Checkins mailing list