[Checkins] SVN: Sandbox/ulif/zope.introspector/src/zope/introspector/objectinfo.py Add a first, plain objectinfo implementation.

Uli Fouquet uli at gnufix.de
Wed Jun 18 05:28:04 EDT 2008


Log message for revision 87492:
  Add a first, plain objectinfo implementation.

Changed:
  A   Sandbox/ulif/zope.introspector/src/zope/introspector/objectinfo.py

-=-
Added: Sandbox/ulif/zope.introspector/src/zope/introspector/objectinfo.py
===================================================================
--- Sandbox/ulif/zope.introspector/src/zope/introspector/objectinfo.py	                        (rev 0)
+++ Sandbox/ulif/zope.introspector/src/zope/introspector/objectinfo.py	2008-06-18 09:28:02 UTC (rev 87492)
@@ -0,0 +1,34 @@
+##############################################################################
+#
+# Copyright (c) 2008 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Representations of simple objects.
+"""
+
+import inspect
+from zope.interface import implements
+from zope.introspector.interfaces import IObjectInfo
+
+class ObjectInfo(object):
+    implements(IObjectInfo)
+    
+    def __init__(self, obj):
+        self.obj = obj
+
+    def getType(self):
+        return type(self.obj)
+
+    def isModule(self):
+        return inspect.ismodule(self.obj)
+
+    def isClass(self):
+        return inspect.isclass(self.obj)



More information about the Checkins mailing list