-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Dectate contains a sphinx extension to help generate dectate documentation. It's unmaintainable grotty sphinx plugin code. It takes care of two things:
- get the docstring from
__init__of the action. - get the argument list correct (the
__init__arguments withoutself).
We can fix the docstring issue by modifying the __doc__ setting behavior in app.py, for instance on the no-more-directive-directive branch:
action_factory_doc = action_factory.__doc__
action_factory_init_doc = None
if hasattr(action_factory, '__init__'):
action_factory_init_doc = action_factory.__init__.__doc__
method.__doc__ = ((action_factory_doc or '') +
(action_factory_init_doc or ''))
Unfortunately the argument list is harder to get right. But we recently started to generate functions in Reg with the right signature, and we could do that in Dectate too. The drawback is that this generated function won't be very pretty in the debugger but it's probably not very comprehensible anyway due to the deferred nature of directive execution. If we could generate the correct list of arguments for our wrapper function, we could do away with the sphinx extension entirely. We'd do a bit of function generation when we import Morepath, but that seems tolerable.