[Twisted-Python] Using Generate Domdocs outside Twisted

Moshe Zadka twisted at moshez.org
Mon Sep 30 02:09:04 MDT 2002


The following patch gives g-d graceful recovery fromt he lack
of the non-standard py2html

Index: admin/generate-domdocs
===================================================================
RCS file: /cvs/Twisted/admin/generate-domdocs,v
retrieving revision 1.23
diff -u -r1.23 generate-domdocs
--- admin/generate-domdocs	30 Sep 2002 07:58:03 -0000	1.23
+++ admin/generate-domdocs	30 Sep 2002 08:01:24 -0000
@@ -32,7 +32,6 @@
 import cStringIO
 import time
 # syntax highlighting for Python source
-import py2html, PyFontify
 from twisted import copyright
 from twisted.python import usage
 
@@ -100,6 +99,16 @@
                 return v
 
 def fontifyFiles(infile, outfile):
+    try:
+        import py2html, PyFontify
+    except ImportError:
+        s = infile.read().replace('&', '&').replace('<', '<').\
+                          replace('>', '>')
+        outfile.write('''\
+<pre>
+%s
+</pre>''' % s)
+        return
     py2html.PrettyPrint(PyFontify.fontify,
                         "rawhtml", "color").file_filter(infile, outfile)
     






More information about the Twisted-Python mailing list