Robert Brewer committed 6263d7e

Bah. I meant to fix help(cherrypy.request) all along for CP 3 final and never got around to it. Here it is, finally; had to monkeypatch pydoc.resolve.

  • Participants
  • Parent commits c973f35

Comments (0)

Files changed (1)

File cherrypy/

 thread_data = _local()
+# Monkeypatch pydoc to allow help() to go through the threadlocal proxy.
+# Jan 2007: no Googleable examples of anyone else replacing pydoc.resolve.
+# The only other way would be to change what is returned from type(request)
+# and that's not possible in pure Python (you'd have to fake ob_type).
+def _cherrypy_pydoc_resolve(thing, forceload=0):
+    """Given an object or a path to an object, get the object and its name."""
+    if isinstance(thing, _ThreadLocalProxy):
+        thing = thing._get_child()
+    return pydoc._builtin_resolve(thing, forceload)
+    import pydoc
+    pydoc._builtin_resolve = pydoc.resolve
+    pydoc.resolve = _cherrypy_pydoc_resolve
+except ImportError:
+    pass
 from cherrypy import _cplogging
 class _GlobalLogManager(_cplogging.LogManager):