mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix #2518: intersphinx_mapping disallows non alphanumeric keys
This commit is contained in:
1
CHANGES
1
CHANGES
@@ -59,6 +59,7 @@ Bugs fixed
|
|||||||
* #2521: generated Makefile causes BSD make crashed if sphinx-build not found
|
* #2521: generated Makefile causes BSD make crashed if sphinx-build not found
|
||||||
* #2470: ``typing`` backport package causes autodoc errors with python 2.7
|
* #2470: ``typing`` backport package causes autodoc errors with python 2.7
|
||||||
* ``sphinx.ext.intersphinx`` crashes if non-string value is used for key of `intersphinx_mapping`
|
* ``sphinx.ext.intersphinx`` crashes if non-string value is used for key of `intersphinx_mapping`
|
||||||
|
* #2518: `intersphinx_mapping` disallows non alphanumeric keys
|
||||||
|
|
||||||
|
|
||||||
Release 1.4.1 (released Apr 12, 2016)
|
Release 1.4.1 (released Apr 12, 2016)
|
||||||
|
|||||||
@@ -274,8 +274,6 @@ def load_mappings(app):
|
|||||||
if not isinstance(name, string_types):
|
if not isinstance(name, string_types):
|
||||||
app.warn('intersphinx identifier %r is not string. Ignored' % name)
|
app.warn('intersphinx identifier %r is not string. Ignored' % name)
|
||||||
continue
|
continue
|
||||||
elif not name.isalnum():
|
|
||||||
app.warn('intersphinx identifier %r is not alphanumeric' % name)
|
|
||||||
else:
|
else:
|
||||||
# old format, no name
|
# old format, no name
|
||||||
name, uri, inv = None, key, value
|
name, uri, inv = None, key, value
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ def test_missing_reference(tempdir, app, status, warning):
|
|||||||
def test_load_mappings_warnings(tempdir, app, status, warning):
|
def test_load_mappings_warnings(tempdir, app, status, warning):
|
||||||
"""
|
"""
|
||||||
load_mappings issues a warning if new-style mapping
|
load_mappings issues a warning if new-style mapping
|
||||||
identifiers are not alphanumeric
|
identifiers are not string
|
||||||
"""
|
"""
|
||||||
inv_file = tempdir / 'inventory'
|
inv_file = tempdir / 'inventory'
|
||||||
inv_file.write_bytes(inventory_v2)
|
inv_file.write_bytes(inventory_v2)
|
||||||
@@ -177,7 +177,7 @@ def test_load_mappings_warnings(tempdir, app, status, warning):
|
|||||||
app.config.intersphinx_cache_limit = 0
|
app.config.intersphinx_cache_limit = 0
|
||||||
# load the inventory and check if it's done correctly
|
# load the inventory and check if it's done correctly
|
||||||
load_mappings(app)
|
load_mappings(app)
|
||||||
assert warning.getvalue().count('\n') == 3
|
assert warning.getvalue().count('\n') == 1
|
||||||
|
|
||||||
|
|
||||||
class TestStripBasicAuth(unittest.TestCase):
|
class TestStripBasicAuth(unittest.TestCase):
|
||||||
|
|||||||
Reference in New Issue
Block a user