[py-svn] r35837 - py/dist/py/rest

cfbolz at codespeak.net cfbolz at codespeak.net
Sat Dec 16 23:01:44 CET 2006


Author: cfbolz
Date: Sat Dec 16 23:01:42 2006
New Revision: 35837

Modified:
   py/dist/py/rest/directive.py
Log:
just checking docutils.__version__ is not enough :-(


Modified: py/dist/py/rest/directive.py
==============================================================================
--- py/dist/py/rest/directive.py	(original)
+++ py/dist/py/rest/directive.py	Sat Dec 16 23:01:42 2006
@@ -9,12 +9,17 @@
 from docutils.parsers.rst import directives, states, roles
 from docutils.parsers.rst.directives import images
 
+if hasattr(images, "image"):
+    directives_are_functions = True
+else:
+    directives_are_functions = False
+
 try:
     from docutils.utils import unescape # docutils version > 0.3.5
 except ImportError:
     from docutils.parsers.rst.states import unescape # docutils 0.3.5
 
-if docutils.__version__ >= '0.5':
+if not directives_are_functions:
     ImageClass = images.Image
 
 else:
@@ -68,7 +73,7 @@
     # a directive does not know the target format
     global _backend
     _backend = backend
-    if docutils.__version__ >= "0.5":
+    if not directives_are_functions:
         directives.register_directive("graphviz", GraphvizDirective)
     else:
         directives.register_directive("graphviz",



More information about the pytest-commit mailing list