mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fixed another of the isinstance tests that should have been issubclass. This doesn't make me look good...
This commit is contained in:
parent
54583227d2
commit
3f7733f8d3
@ -12,12 +12,16 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
import types
|
||||||
import posixpath
|
import posixpath
|
||||||
from cStringIO import StringIO
|
from cStringIO import StringIO
|
||||||
|
|
||||||
from docutils import nodes
|
from docutils import nodes
|
||||||
from docutils.parsers.rst import directives, roles
|
from docutils.parsers.rst import directives, roles
|
||||||
|
|
||||||
|
# Directive is either new-style or old-style
|
||||||
|
clstypes = (type, types.ClassType)
|
||||||
|
|
||||||
# create the error classes before importing the rest of Sphinx, so that
|
# create the error classes before importing the rest of Sphinx, so that
|
||||||
# they can be imported in a circular fashion
|
# they can be imported in a circular fashion
|
||||||
|
|
||||||
@ -298,7 +302,7 @@ class Sphinx(object):
|
|||||||
setattr(translator, 'depart_'+node.__name__, depart)
|
setattr(translator, 'depart_'+node.__name__, depart)
|
||||||
|
|
||||||
def add_directive(self, name, obj, content=None, arguments=None, **options):
|
def add_directive(self, name, obj, content=None, arguments=None, **options):
|
||||||
if isinstance(obj, Directive):
|
if isinstance(obj, clstypes) and issubclass(obj, Directive):
|
||||||
if content or arguments or options:
|
if content or arguments or options:
|
||||||
raise ExtensionError('when adding directive classes, no '
|
raise ExtensionError('when adding directive classes, no '
|
||||||
'additional arguments may be given')
|
'additional arguments may be given')
|
||||||
|
Loading…
Reference in New Issue
Block a user