Skip to content

Commit 87c029a

Browse files
authored
Merge pull request #1008 from sphinx-contrib/cleanup-publish-debug-options
cleanup publish debug options (format/presentation)
2 parents 54b1fea + 2fcbbfa commit 87c029a

File tree

5 files changed

+11
-9
lines changed

5 files changed

+11
-9
lines changed

doc/configuration.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1524,7 +1524,7 @@ Advanced publishing configuration
15241524

15251525
.. versionchanged:: 2.6
15261526

1527-
Introduce the ``headers_and_data`` option.
1527+
Introduce the ``headers-and-data`` option.
15281528

15291529
.. warning::
15301530

@@ -1544,7 +1544,7 @@ Advanced publishing configuration
15441544
- ``deprecated``: Log warnings when a deprecated API call is used
15451545
(*for development purposes*).
15461546
- ``headers``: Log requests and responses, including their headers.
1547-
- ``headers_and_data``: Log header data along with request/response bodies.
1547+
- ``headers-and-data``: Log header data along with request/response bodies.
15481548
- ``urllib3``: Enable urllib3 library debugging messages.
15491549

15501550
An example debugging configuration is as follows:

sphinxcontrib/confluencebuilder/config/checks.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -533,15 +533,13 @@ def conf_translate(value):
533533
# ##################################################################
534534

535535
# confluence_publish_debug
536-
opts = PublishDebug._member_names_ # pylint: disable=no-member
537536
try:
538537
validator.conf('confluence_publish_debug').bool() # deprecated
539538
except ConfluenceConfigError:
540539
try:
541540
validator.conf('confluence_publish_debug').enum(PublishDebug)
542541
except ConfluenceConfigError as ex:
543-
opts_str = '\n - '.join(opts)
544-
raise ConfluencePublishDebugConfigError(ex, opts_str) from ex
542+
raise ConfluencePublishDebugConfigError(ex) from ex
545543

546544
# ##################################################################
547545

sphinxcontrib/confluencebuilder/config/defaults.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ def apply_defaults(builder):
107107
if publish_debug is True:
108108
conf.confluence_publish_debug = PublishDebug.urllib3
109109
elif isinstance(publish_debug, str) and publish_debug:
110-
conf.confluence_publish_debug = PublishDebug[publish_debug.lower()]
110+
raw_debug = publish_debug.replace('-', '_').lower()
111+
conf.confluence_publish_debug = PublishDebug[raw_debug]
111112
else:
112113
conf.confluence_publish_debug = PublishDebug.none
113114

sphinxcontrib/confluencebuilder/config/exceptions.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,15 +229,18 @@ def __init__(self):
229229

230230

231231
class ConfluencePublishDebugConfigError(ConfluenceConfigError):
232-
def __init__(self, msg, opts):
232+
def __init__(self, msg):
233233
super().__init__(f'''\
234234
{msg}
235235
236236
The option 'confluence_publish_debug' has been configured to enable publish
237237
debugging. Accepted values include:
238238
239239
- all
240-
- {opts}
240+
- deprecated
241+
- headers
242+
- headers-and-data
243+
- urllib3
241244
''')
242245

243246

sphinxcontrib/confluencebuilder/config/validation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ def enum(self, etype):
218218

219219
if value is not None and not isinstance(value, etype):
220220
try:
221-
value = etype[value.lower()]
221+
value = etype[value.replace('-', '_').lower()]
222222
except (AttributeError, KeyError) as ex:
223223
msg = f'{self.key} is not an enumeration ({etype.__name__})'
224224
raise ConfluenceConfigError(msg) from ex

0 commit comments

Comments
 (0)