From 2b99c39c30df432fe79cbfe3db0f21039e324fb4 Mon Sep 17 00:00:00 2001 From: Doug Hellmann Date: Fri, 28 Jul 2017 13:35:33 -0400 Subject: [PATCH] fix formatting for empty defaults When the default for a policy rule is empty, the output is ````. The rst parser interprets that as a title overline or underline, and sphinx dies. When we have no default rule emit a string saying so to avoid emitting an empty literal inline block. Closes-Bug: 1707246 Change-Id: I774b2de5ff59874dfa67811c094735dd74c8083e Signed-off-by: Doug Hellmann --- oslo_policy/sphinxext.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/oslo_policy/sphinxext.py b/oslo_policy/sphinxext.py index e3d7e1e6..dcb84710 100644 --- a/oslo_policy/sphinxext.py +++ b/oslo_policy/sphinxext.py @@ -51,7 +51,10 @@ def _format_policy_rule(rule): """ yield '``{}``'.format(rule.name) - yield _indent(':Default: ``{}``'.format(rule.check_str)) + if rule.check_str: + yield _indent(':Default: ``{}``'.format(rule.check_str)) + else: + yield _indent(':Default: ') if hasattr(rule, 'operations'): yield _indent(':Operations:')