diff -urB wsmeext/sphinxext.py.ori wsmeext/sphinxext.py --- wsmeext/sphinxext.py.ori 2015-06-01 15:19:37.000000000 +0200 +++ wsmeext/sphinxext.py 2015-09-11 11:45:05.000000000 +0200 @@ -111,13 +111,35 @@ return root +#def get_class_that_defined_method(meth): +# imc = getattr(meth, 'im_class', None) +# if imc: +# for cls in inspect.getmro(imc): +# if meth.__name__ in cls.__dict__: +# return cls +# return None + + +def get_class_that_defined_method(meth): + for cls in inspect.getmro(meth.im_class): + if meth.__name__ in cls.__dict__: + return cls + return None + + def scan_services(service, path=[]): has_functions = False for name in dir(service): if name.startswith('_'): continue + if name in ('im_self', 'im_func', 'im_class'): + continue a = getattr(service, name) + if inspect.isfunction(a): + continue if inspect.ismethod(a): + if get_class_that_defined_method(a) == wsme.WSRoot: + continue if hasattr(a, '_wsme_definition'): has_functions = True if inspect.isclass(a): @@ -135,7 +157,7 @@ if service == root: return [] for s, path in scan_services(root): - if s == service: + if s == service or type(s) == service: return path return None @@ -361,7 +383,7 @@ def format_name(self): path = find_service_path(self.env, self.object) - return '/' + '/'.join(path) + return '/' + ('/'.join(path) if path else '') class FunctionDirective(PyClassmember):