changeset 467:7fd8af79e652

check if tracks directory exists before walking it.
author Sascha Teichmann <teichmann@intevation.de>
date Thu, 09 Sep 2010 15:13:35 +0000
parents e4c0beab5328
children 0cbf154431db
files contrib/sawmill/web/details.py
diffstat 1 files changed, 12 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/sawmill/web/details.py	Thu Sep 09 14:46:13 2010 +0000
+++ b/contrib/sawmill/web/details.py	Thu Sep 09 15:13:35 2010 +0000
@@ -98,17 +98,18 @@
     items = []
 
     tracks_path = os.path.join(path, "tracks")
-    for track in os.listdir(tracks_path):
-        track_path = os.path.join(tracks_path, track)
-        if not os.path.isdir(track_path): continue
-        revisions_path = os.path.join(track_path, "pkg")
-        if not os.path.isdir(revisions_path): continue
-        for revision in os.listdir(revisions_path):
-            revision_path = os.path.join(revisions_path, revision)
-            if not os.path.isdir(revision_path): continue
-            status_file = os.path.join(revision_path, "status")
-            if not os.path.isfile(status_file): continue
-            items.append(TrackItem(treepkg, track, revision, status_file))
+    if os.path.isdir(track_path):
+        for track in os.listdir(tracks_path):
+            track_path = os.path.join(tracks_path, track)
+            if not os.path.isdir(track_path): continue
+            revisions_path = os.path.join(track_path, "pkg")
+            if not os.path.isdir(revisions_path): continue
+            for revision in os.listdir(revisions_path):
+                revision_path = os.path.join(revisions_path, revision)
+                if not os.path.isdir(revision_path): continue
+                status_file = os.path.join(revision_path, "status")
+                if not os.path.isfile(status_file): continue
+                items.append(TrackItem(treepkg, track, revision, status_file))
             
     return items
 
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)