From bd95dafa7b6b55eba80a1b48dbefb5aa7468063c Mon Sep 17 00:00:00 2001 From: Christophe de Vienne Date: Thu, 6 Dec 2012 16:18:01 +0100 Subject: [PATCH] Allow the method autodocumenter (.. autofunction) to work without a Service parent (ie without a WSRoot). Added the path & method parameters that NOT considered for now. --- wsme/pecan.py | 1 + wsme/sphinxext.py | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/wsme/pecan.py b/wsme/pecan.py index f0ad4e5..3e70c54 100644 --- a/wsme/pecan.py +++ b/wsme/pecan.py @@ -65,6 +65,7 @@ def wsexpose(*args, **kwargs): pecan_xml_decorate(callfunction) pecan_json_decorate(callfunction) pecan.util._cfg(callfunction)['argspec'] = inspect.getargspec(f) + callfunction._wsme_definition = funcdef return callfunction return decorate diff --git a/wsme/sphinxext.py b/wsme/sphinxext.py index 4a55c69..5a6d02f 100644 --- a/wsme/sphinxext.py +++ b/wsme/sphinxext.py @@ -334,10 +334,14 @@ class FunctionDocumenter(autodoc.MethodDocumenter): objtype = 'function' priority = 1 + option_spec = { + 'path': directives.unchanged, + 'method': directives.unchanged + } + @classmethod def can_document_member(cls, member, membername, isattr, parent): - return isinstance(parent, ServiceDocumenter) \ - and wsme.api.iswsmefunction(member) + return wsme.api.iswsmefunction(member) def import_object(self): ret = super(FunctionDocumenter, self).import_object()