[Checkins] SVN: Sandbox/ulif/grok-adminui/doc/grok2html.py Fixed handling of relative paths and creation of subdirs during doc-creation.

Uli Fouquet uli at gnufix.de
Thu Jul 19 07:28:45 EDT 2007


Log message for revision 78151:
  Fixed handling of relative paths and creation of subdirs during doc-creation.

Changed:
  U   Sandbox/ulif/grok-adminui/doc/grok2html.py

-=-
Modified: Sandbox/ulif/grok-adminui/doc/grok2html.py
===================================================================
--- Sandbox/ulif/grok-adminui/doc/grok2html.py	2007-07-19 10:07:29 UTC (rev 78150)
+++ Sandbox/ulif/grok-adminui/doc/grok2html.py	2007-07-19 11:28:44 UTC (rev 78151)
@@ -69,6 +69,10 @@
         settings["context"] = Context(self.url, self.title, self.content)
         content = page.pt_render(namespace=settings)
         #fp = open(self.target, 'w')
+        targetdir = os.path.dirname(self.target)
+        if not os.path.isdir(targetdir):
+            print 'Creating dir: ', targetdir
+            os.mkdir(targetdir)
         fp = codecs.open(self.target,"w",'utf8')
         fp.write(content)
         fp.close()
@@ -122,8 +126,13 @@
         sys.exit(1)
 
     source_dir = os.path.dirname(__file__)
+    www_dir = os.path.abspath(argv[0])
+
+    if not os.path.isdir(www_dir):
+        print "OUTDIR '%s' does not exist." % (www_dir,)
+        sys.exit(1)
+    
     os.chdir(source_dir)
-    www_dir = argv[0]
 
     rest_files = []
     rest_files.append(RestFile('index', 



More information about the Checkins mailing list