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.

This commit is contained in:
Christophe de Vienne 2012-12-06 16:18:01 +01:00
parent dcd2d9233f
commit bd95dafa7b
2 changed files with 7 additions and 2 deletions

View File

@ -65,6 +65,7 @@ def wsexpose(*args, **kwargs):
pecan_xml_decorate(callfunction) pecan_xml_decorate(callfunction)
pecan_json_decorate(callfunction) pecan_json_decorate(callfunction)
pecan.util._cfg(callfunction)['argspec'] = inspect.getargspec(f) pecan.util._cfg(callfunction)['argspec'] = inspect.getargspec(f)
callfunction._wsme_definition = funcdef
return callfunction return callfunction
return decorate return decorate

View File

@ -334,10 +334,14 @@ class FunctionDocumenter(autodoc.MethodDocumenter):
objtype = 'function' objtype = 'function'
priority = 1 priority = 1
option_spec = {
'path': directives.unchanged,
'method': directives.unchanged
}
@classmethod @classmethod
def can_document_member(cls, member, membername, isattr, parent): def can_document_member(cls, member, membername, isattr, parent):
return isinstance(parent, ServiceDocumenter) \ return wsme.api.iswsmefunction(member)
and wsme.api.iswsmefunction(member)
def import_object(self): def import_object(self):
ret = super(FunctionDocumenter, self).import_object() ret = super(FunctionDocumenter, self).import_object()