Skip to content

Commit fb7a331

Browse files
author
Borys Belinsky
committed
Update psdom extension to work for Python 2.7 and Sphinx <1.8
1 parent ed345a5 commit fb7a331

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

source/ext/psdom.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,24 @@
1010
import string
1111

1212
from docutils import nodes
13-
#from docutils.parsers.rst import directives
13+
1414

1515
from sphinx import addnodes
1616
from sphinx.roles import XRefRole
1717
from sphinx.locale import l_, _
1818
from sphinx.domains import Domain, ObjType, Index
1919
from sphinx.directives import ObjectDescription
2020
from sphinx.util.nodes import make_refnode
21+
22+
# Uncomment for sphinx <1.8
23+
#from docutils.parsers.rst import directives
2124
#from sphinx.util.compat import Directive
25+
# Comment for sphinx <1.8 and uncomment for sphinx 1.8+
26+
#from docutils.parsers.rst import Directive, directives
27+
28+
2229
from sphinx.util.docfields import Field, GroupedField, TypedField
2330

24-
from docutils.parsers.rst import Directive, directives
2531

2632
# RE to split at word boundaries
2733
wsplit_re = re.compile(r'\W+')
@@ -353,7 +359,8 @@ class PerconaServerDomain(Domain):
353359
}
354360

355361
def clear_doc(self, docname):
356-
for fullname, (fn, _) in self.data['objects'].items():
362+
# use iteritems() if Python 2.7; items() for Python 3
363+
for fullname, (fn, _) in self.data['objects'].iteritems():
357364
if fn == docname:
358365
del self.data['objects'][fullname]
359366

0 commit comments

Comments
 (0)