From 8e23ffceaa373ee344bdd3ba02d4bff51e1d5ad9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Delaun=C3=A9?= Date: Fri, 27 Mar 2015 19:01:04 +0100 Subject: [PATCH] fix bad autodoc signature when functions are decorated --- docs/conf.py | 2 ++ flask/app.py | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index 922f2f7e..c830cf46 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -19,6 +19,8 @@ import sys, os sys.path.append(os.path.abspath('_themes')) sys.path.append(os.path.abspath('.')) +os.environ['SPHINX_BUILD'] = '1' + # -- General configuration ----------------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. diff --git a/flask/app.py b/flask/app.py index 1f7df2e8..4a2fad09 100644 --- a/flask/app.py +++ b/flask/app.py @@ -41,6 +41,9 @@ _logger_lock = Lock() # a singleton sentinel value for parameter defaults _sentinel = object() +# Returns functions instead of decorators when building the documentation +IS_SPHINX_BUILD = bool(os.getenv('SPHINX_BUILD')) + def _make_timedelta(value): if not isinstance(value, timedelta): @@ -62,7 +65,7 @@ def setupmethod(f): 'database models and everything related at a central place ' 'before the application starts serving requests.') return f(self, *args, **kwargs) - return update_wrapper(wrapper_func, f) + return f if IS_SPHINX_BUILD else update_wrapper(wrapper_func, f) class Flask(_PackageBoundObject):