summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2011-01-07 15:59:37 -0500
committerChris McDonough <chrism@plope.com>2011-01-07 15:59:37 -0500
commitbe5f12ca5624130e6a61297d4c944cc65f757f52 (patch)
treed10e92756aa5d4903575e5cdb879b6ca569ddf65 /docs
parent780b6f1937b12ebaf99147ed996f224dc169fc9f (diff)
downloadpyramid-be5f12ca5624130e6a61297d4c944cc65f757f52.tar.gz
pyramid-be5f12ca5624130e6a61297d4c944cc65f757f52.tar.bz2
pyramid-be5f12ca5624130e6a61297d4c944cc65f757f52.zip
preserve method signatures of @action_method-decorated methods in sphinx docs
Diffstat (limited to 'docs')
-rw-r--r--docs/conf.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/docs/conf.py b/docs/conf.py
index d69936cf8..2f4c5227a 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -13,6 +13,7 @@
import sys, os
import datetime
+import inspect
import warnings
warnings.simplefilter('ignore', DeprecationWarning)
@@ -407,6 +408,18 @@ def setup(app):
app.add_directive('frontmatter', frontmatter, 1, (0, 0, 0))
app.add_directive('mainmatter', mainmatter, 1, (0, 0, 0))
app.add_directive('backmatter', backmatter, 1, (0, 0, 0))
+ app.connect('autodoc-process-signature', resig)
+
+def resig(app, what, name, obj, options, signature, return_annotation):
+ """ Allow for preservation of ``@action_method`` decorated methods
+ in configurator """
+ docobj = getattr(obj, '__docobj__', None)
+ if docobj is not None:
+ argspec = inspect.getargspec(docobj)
+ if argspec[0] and argspec[0][0] in ('cls', 'self'):
+ del argspec[0][0]
+ signature = inspect.formatargspec(*argspec)
+ return signature, return_annotation
# turn off all line numbers in latex formatting