Code

Ticket #13616: 13616_2.diff

File 13616_2.diff, 1.6 KB (added by andrewsk, 4 years ago)

Fixes DeprecationWarning about xfileref_role

Line 
1diff --git a/docs/_ext/djangodocs.py b/docs/_ext/djangodocs.py
2index aaad219..fdedbc7 100644
3--- a/docs/_ext/djangodocs.py
4+++ b/docs/_ext/djangodocs.py
5@@ -71,7 +71,7 @@ def parse_version_directive(name, arguments, options, content, lineno,
6     if not is_nextversion:
7         if len(arguments) == 1:
8             linktext = 'Please, see the release notes <releases-%s>' % (arguments[0])
9-            xrefs = sphinx.roles.xfileref_role('ref', linktext, linktext, lineno, state)
10+            xrefs = sphinx.roles.XRefRole()('ref', linktext, linktext, lineno, state)
11             node.extend(xrefs[0])
12         node['version'] = arguments[0]
13     else:
14@@ -83,7 +83,11 @@ def parse_version_directive(name, arguments, options, content, lineno,
15         if content:
16             state.nested_parse(content, content_offset, node)
17         ret = ret + messages
18-    env.note_versionchange(node['type'], node['version'], node, lineno)
19+    env.versionchanges.setdefault(node['version'], []).append(
20+        (node['type'], env.temp_data['docname'], lineno,
21+        env.temp_data.get('py_module'),
22+        env.temp_data.get('object'),
23+        node.astext()))
24     return ret
25 
26                 
27@@ -195,7 +199,7 @@ def parse_django_admin_node(env, sig, signode):
28 def parse_django_adminopt_node(env, sig, signode):
29     """A copy of sphinx.directives.CmdoptionDesc.parse_signature()"""
30     from sphinx import addnodes
31-    from sphinx.directives.desc import option_desc_re
32+    from sphinx.domains.std import option_desc_re
33     count = 0
34     firstname = ''
35     for m in option_desc_re.finditer(sig):