[Python-checkins] CVS: python/dist/src/Lib pydoc.py,1.47,1.48
Tim Peters
tim_one@users.sourceforge.net
Mon, 24 Sep 2001 17:01:08 -0700
Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv1776/python/Lib
Modified Files:
pydoc.py
Log Message:
GUI mode now displays useful stuff for properties. This is usually better
than text mode, since here we can hyperlink from the getter etc methods
back to their definitions.
Index: pydoc.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/pydoc.py,v
retrieving revision 1.47
retrieving revision 1.48
diff -C2 -d -r1.47 -r1.48
*** pydoc.py 2001/09/24 22:40:47 1.47
--- pydoc.py 2001/09/25 00:01:06 1.48
***************
*** 637,643 ****
return attrs
- # pydoc can't make any reasonable sense of properties on its own,
- # and it doesn't appear that the getter, setter and del'er methods
- # are discoverable. For now, just pump out their names.
def spillproperties(msg, attrs, predicate):
ok, attrs = _split_list(attrs, predicate)
--- 637,640 ----
***************
*** 646,650 ****
push(msg)
for name, kind, homecls, value in ok:
! push('<dl><dt><strong>%s</strong></dl>\n' % name)
return attrs
--- 643,660 ----
push(msg)
for name, kind, homecls, value in ok:
! push('<dl><dt><strong>%s</strong></dt>\n' % name)
! if value.__doc__ is not None:
! doc = self.markup(value.__doc__, self.preformat,
! funcs, classes, mdict)
! push('<dd><small><tt>%s</tt></small></dd>\n' % doc)
! for attr, tag in [("fset", " setter"),
! ("fget", " getter"),
! ("fdel", " deleter")]:
! func = getattr(value, attr)
! if func is not None:
! base = self.document(func, name + tag, mod,
! funcs, classes, mdict, object)
! push('<dd>%s</dd>\n' % base)
! push('</dl>\n')
return attrs