Use inspect.stack()[1][3] to tell if Helper.__repr__ is called interactively.
This commit is contained in:
parent
eca15c1fb1
commit
9bc576b7f6
|
@ -1268,10 +1268,10 @@ class Helper:
|
||||||
self.docdir = dir
|
self.docdir = dir
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
if len(inspect.stack()) <= 2:
|
if inspect.stack()[1][3] == '?':
|
||||||
self()
|
self()
|
||||||
return ''
|
return ''
|
||||||
return '<pydoc.Helper instance at %p>' % id(self)
|
return '<pydoc.Helper instance>'
|
||||||
|
|
||||||
def __call__(self, request=None):
|
def __call__(self, request=None):
|
||||||
if request is not None:
|
if request is not None:
|
||||||
|
|
Loading…
Reference in New Issue