comparison 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
comparison
equal deleted inserted replaced
466:e4c0beab5328 467:7fd8af79e652
96 96
97 def __scan_track_items(treepkg, path): 97 def __scan_track_items(treepkg, path):
98 items = [] 98 items = []
99 99
100 tracks_path = os.path.join(path, "tracks") 100 tracks_path = os.path.join(path, "tracks")
101 for track in os.listdir(tracks_path): 101 if os.path.isdir(track_path):
102 track_path = os.path.join(tracks_path, track) 102 for track in os.listdir(tracks_path):
103 if not os.path.isdir(track_path): continue 103 track_path = os.path.join(tracks_path, track)
104 revisions_path = os.path.join(track_path, "pkg") 104 if not os.path.isdir(track_path): continue
105 if not os.path.isdir(revisions_path): continue 105 revisions_path = os.path.join(track_path, "pkg")
106 for revision in os.listdir(revisions_path): 106 if not os.path.isdir(revisions_path): continue
107 revision_path = os.path.join(revisions_path, revision) 107 for revision in os.listdir(revisions_path):
108 if not os.path.isdir(revision_path): continue 108 revision_path = os.path.join(revisions_path, revision)
109 status_file = os.path.join(revision_path, "status") 109 if not os.path.isdir(revision_path): continue
110 if not os.path.isfile(status_file): continue 110 status_file = os.path.join(revision_path, "status")
111 items.append(TrackItem(treepkg, track, revision, status_file)) 111 if not os.path.isfile(status_file): continue
112 items.append(TrackItem(treepkg, track, revision, status_file))
112 113
113 return items 114 return items
114 115
115 def __description_header(treepkg): 116 def __description_header(treepkg):
116 treepkg_xml = os.path.join(treepkg, "treepkg.xml") 117 treepkg_xml = os.path.join(treepkg, "treepkg.xml")
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)