[Epydoc-commits] SF.net SVN: epydoc: [1501] trunk/epydoc/src/epydoc/docintrospecter.py
Brought to you by:
edloper
From: <ed...@us...> - 2007-02-14 08:37:02
|
Revision: 1501 http://svn.sourceforge.net/epydoc/?rev=1501&view=rev Author: edloper Date: 2007-02-14 00:36:59 -0800 (Wed, 14 Feb 2007) Log Message: ----------- - Added preliminary support for zope2 and zope3 introspection. Modified Paths: -------------- trunk/epydoc/src/epydoc/docintrospecter.py Modified: trunk/epydoc/src/epydoc/docintrospecter.py =================================================================== --- trunk/epydoc/src/epydoc/docintrospecter.py 2007-02-14 06:15:18 UTC (rev 1500) +++ trunk/epydoc/src/epydoc/docintrospecter.py 2007-02-14 08:36:59 UTC (rev 1501) @@ -514,8 +514,17 @@ C{__bases__} attribute, including objects that define C{__getattr__} to always return a value). """ - return isinstance(object, (TypeType, ClassType)) + return isinstance(object, tuple(_CLASS_TYPES)) +_CLASS_TYPES = set([TypeType, ClassType]) +"""A list of types that should be treated as classes.""" + +def register_class_type(typ): + """Add a type to the lists of types that should be treated as + classes. By default, this list contains C{TypeType} and + C{ClassType}.""" + _CLASS_TYPES.add(typ) + __future_check_works = None def is_future_feature(object): @@ -598,7 +607,7 @@ if isinstance(value, ModuleType): dotted_name = DottedName(value.__name__) - elif isinstance(value, (ClassType, TypeType)): + elif isclass(value): if value.__module__ == '__builtin__': dotted_name = DottedName(value.__name__) else: @@ -961,10 +970,39 @@ xreadlines = readlines _dev_null = _DevNull() +###################################################################### +## Zope InterfaceClass +###################################################################### +try: + from zope.interface.interface import InterfaceClass as _ZopeInterfaceClass + register_class_type(_ZopeInterfaceClass) +except: + pass +###################################################################### +## Zope Extension classes +###################################################################### +try: + # Register type(ExtensionClass.ExtensionClass) + from ExtensionClass import ExtensionClass as _ExtensionClass + _ZopeType = type(_ExtensionClass) + def _is_zope_type(val): + return isinstance(val, _ZopeType) + register_introspecter(_is_zope_type, introspect_class) + # Register ExtensionClass.*MethodType + from ExtensionClass import PythonMethodType as _ZopeMethodType + from ExtensionClass import ExtensionMethodType as _ZopeCMethodType + def _is_zope_method(val): + return isinstance(val, (_ZopeMethodType, _ZopeCMethodType)) + register_introspecter(_is_zope_method, introspect_routine) +except: + pass + + + # [xx] 0 # hm.. otherwise the following gets treated as a docstring! ouch! This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |