[Zope-Checkins] SVN: Zope/branches/gsoc-python-2.5/lib/python/Zope2/Startup/warnfilter.py - Accept new-style classes as valid warning categories. Patch by

Sidnei da Silva sidnei at enfoldsystems.com
Tue Oct 7 15:25:17 EDT 2008


Log message for revision 91879:
  - Accept new-style classes as valid warning categories. Patch by
    Ranjith Kannikara, GSoC student.
  
  

Changed:
  U   Zope/branches/gsoc-python-2.5/lib/python/Zope2/Startup/warnfilter.py

-=-
Modified: Zope/branches/gsoc-python-2.5/lib/python/Zope2/Startup/warnfilter.py
===================================================================
--- Zope/branches/gsoc-python-2.5/lib/python/Zope2/Startup/warnfilter.py	2008-10-07 18:32:12 UTC (rev 91878)
+++ Zope/branches/gsoc-python-2.5/lib/python/Zope2/Startup/warnfilter.py	2008-10-07 19:25:16 UTC (rev 91879)
@@ -35,7 +35,7 @@
             cat = getattr(m, klass)
         except AttributeError:
             raise ValueError("unknown warning category: %s" % `category`)
-    if (not isinstance(cat, types.ClassType) or
+    if (not isinstance(cat, (type, types.ClassType)) or
         not issubclass(cat, Warning)):
         raise ValueError("invalid warning category: %s" % `category`)
     return cat



More information about the Zope-Checkins mailing list