Hi,
   What is the preferred way to check type in Zope 3.
I got lots of output for these two commands:
 $ find . -name "*.py"|xargs grep "from types"
 $ find . -name "*.py"|xargs grep "import types"

In some places type(module) is used. See this patch, a single
-1 is enough for me to not commit it.
A commit for simple code beautification is bad :)

Regards,
Baiju M

Index: src/zope/interface/declarations.py
===================================================================
--- src/zope/interface/declarations.py  (revision 70053)
+++ src/zope/interface/declarations.py  (working copy)
@@ -34,7 +34,7 @@
 from zope.interface.interface import InterfaceClass, Specification
 from ro import mergeOrderings, ro
import exceptions
-from types import ClassType
+from types import ClassType, ModuleType
 from zope.interface.advice import addClassAdvisor

# Registry of class-implementation specifications
@@ -1170,9 +1170,7 @@
        raise TypeError(
            "moduleProvides can only be used once in a module definition.")

-    module = sys.modules[__name__]
-
-    locals["__provides__"] = Provides(type(module),
+    locals["__provides__"] = Provides(ModuleType,
                                      *_normalizeargs(interfaces))

##############################################################################
_______________________________________________
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com

Reply via email to