summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Hellmann <doug@doughellmann.com>2017-07-28 13:35:33 -0400
committerLance Bragstad <lbragstad@gmail.com>2017-07-28 18:26:44 +0000
commit2b99c39c30df432fe79cbfe3db0f21039e324fb4 (patch)
treed9dd98a24fb385fda7af1ca28802420f207be15d
parent540503294cf9429280b9bcc7ed4bad1febde7362 (diff)
downloadoslo-policy-2b99c39c30df432fe79cbfe3db0f21039e324fb4.tar.gz
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 <doug@doughellmann.com>
-rw-r--r--oslo_policy/sphinxext.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/oslo_policy/sphinxext.py b/oslo_policy/sphinxext.py
index e3d7e1e..dcb8471 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: <empty string>')
if hasattr(rule, 'operations'):
yield _indent(':Operations:')