diff contrib/sawmill/web/details.py @ 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 52f841330c16
children d8012571f9e1
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)