[library-web/new-website-style: 23/24] do not use a fixed location for indexes.xml



commit 90b29ca7d44c15fb04347a086bc35113cfed9172
Author: Frédéric Péters <fpeters 0d be>
Date:   Sun Mar 20 12:35:42 2011 +0100

    do not use a fixed location for indexes.xml

 src/lgo.py |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)
---
diff --git a/src/lgo.py b/src/lgo.py
index e3af0bc..c419dd4 100755
--- a/src/lgo.py
+++ b/src/lgo.py
@@ -21,6 +21,7 @@
 import os
 import sys
 import re
+import tempfile
 import urllib2
 from cStringIO import StringIO
 from optparse import OptionParser
@@ -647,12 +648,9 @@ class Lgo(App):
                         logging.warn('%s channel is missing some sections: %s' % (
                                 channel, ', '.join(remaining_sections)))
 
-        idx_dirname = os.path.join(self.config.private_dir, 'indexes')
-        if not os.path.exists(idx_dirname):
-            os.makedirs(idx_dirname)
-
+        self.indexes_tmp_file = tempfile.NamedTemporaryFile()
         tree = ET.ElementTree(indexes)
-        tree.write(os.path.join(idx_dirname, 'indexes.xml'))
+        tree.write(self.indexes_tmp_file.name)
 
     def create_section(self, index, section, section_docs, lang):
         section_node = ET.SubElement(index, 'section')
@@ -698,7 +696,7 @@ class Lgo(App):
                         original_language = lang)
 
     def generate_from_indexes(self, xsl_filename):
-        idx_filename = os.path.join(self.config.private_dir, 'indexes', 'indexes.xml')
+        idx_filename = self.indexes_tmp_file.name
 
         cmd = ['xsltproc', '--output', self.config.output_dir,
                 '--nonet', '--xinclude', xsl_filename, idx_filename]



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]