changeset 148:25d4949ac2d8

Adapt web.py to use list_log_files when handling log files.
author Bernhard Herzog <bh@intevation.de>
date Thu, 05 Jun 2008 12:13:38 +0000
parents cfeb0251055b
children 4526105f81a7
files treepkg/web.py
diffstat 1 files changed, 13 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/treepkg/web.py	Thu Jun 05 11:06:58 2008 +0000
+++ b/treepkg/web.py	Thu Jun 05 12:13:38 2008 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2007 by Intevation GmbH
+# Copyright (C) 2007, 2008 by Intevation GmbH
 # Authors:
 # Bernhard Herzog <bh@intevation.de>
 #
@@ -32,22 +32,23 @@
         stream = tmpl.generate(report=report.prepare_report(group))
         return stream.render('html')
 
-    def build_log_filename(self, package_track_name, revno):
-        """Returns the name of the build log file of a revision if it exists"""
+    def determine_log_filename(self, package_track_name, revno, log_basename):
+        """Returns the name of a log file of a revision if it exists"""
         group = report.get_packager_group(self.treepkg_config)
         for track in group.get_package_tracks():
             if track.name == package_track_name:
                 for revision in track.get_revisions():
                     if str(revision.revision) == revno:
-                        if revision.has_build_log():
-                            return revision.build_log
+                        for title, filename in revision.list_log_files():
+                            if os.path.basename(filename) == log_basename:
+                                return filename
 
     @expose
     def default(self, *rest):
-        """Handles requests for .../pkg/revno/build_log.txt"""
+        """Handles requests for logfiles of the form .../pkg/revno/*"""
         filename = None
-        if len(rest) == 3 and rest[2] == "build_log.txt":
-            filename = self.build_log_filename(*rest[:2])
+        if len(rest) == 3:
+            filename = self.determine_log_filename(*rest)
         if filename is not None:
             return cptools.serveFile(filename, contentType="text/plain")
         else:
@@ -74,8 +75,10 @@
                     if not os.path.isdir(trackdir):
                         os.mkdir(trackdir)
                     os.mkdir(revdir)
-                    os.symlink(revision.build_log,
-                               os.path.join(revdir, "build_log.txt"))
+                    for title, filename in revision.list_log_files():
+                        os.symlink(filename,
+                                   os.path.join(revdir,
+                                                os.path.basename(filename)))
 
 
 
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)