[Doc-SIG] Minor bugfix/optimisation for doc_collect

Mike Fletcher mcfletch@golden.net
Tue, 31 Mar 1998 19:10:15 -0500


Evening all,

Currently doc_collect does nasty things with at least one (perfectly valid)
module I've written.  The following seems to fix it, would appreciate input
as to whether it would break anything:

8<___ doc_collect.py line 132+ ______
def whichmoduleobj(cls):
    """Figure out the module in which a class occurs.
    
    Search sys.modules for the module.
    Cache in classmap.
    Return a module object.
    If the class cannot be found, raise exception.
    """
    ### Altered by mcfletch 98.03.31 to use 1.5 stuff
    if hasattr( cls, '__module__' ):
	try:
	    import sys
	    return sys.modules[ cls.__module__ ] # is this always imported???
	except:
	    pass
    ### End mcfletch alterations
    if _classmap.has_key(cls):
	return _classmap[cls]
    ...
________________________________
 M i k e   C .  F l e t c h e r

       mcfletch@golden.net
http://www.golden.net/~mcfletch/
________________________________
 Design, Consultation, Training
     Now available for hire