From 3f7733f8d303b10b5a72ea0a52508c63a1eb6034 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Thu, 19 Feb 2009 23:22:36 +0100 Subject: [PATCH] Fixed another of the isinstance tests that should have been issubclass. This doesn't make me look good... --- sphinx/application.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sphinx/application.py b/sphinx/application.py index d5f4a1baf..f75d746da 100644 --- a/sphinx/application.py +++ b/sphinx/application.py @@ -12,12 +12,16 @@ """ import sys +import types import posixpath from cStringIO import StringIO from docutils import nodes 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 # they can be imported in a circular fashion @@ -298,7 +302,7 @@ class Sphinx(object): setattr(translator, 'depart_'+node.__name__, depart) 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: raise ExtensionError('when adding directive classes, no ' 'additional arguments may be given')