Mercurial > dive4elements > river
view flys-backend/contrib/shpimporter/utils.py @ 4376:3c8964855270
Avoid NullPointerExceptions if no settings are available
Don't fail with a NullPointerExceptions if no setting for the axis is available.
author | Björn Ricks <bjoern.ricks@intevation.de> |
---|---|
date | Fri, 02 Nov 2012 15:41:52 +0100 (2012-11-02) |
parents | 59ca5dab2782 |
children | b1d7e600b43b |
line wrap: on
line source
import os from shpimporter import DEBUG, INFO, ERROR SHP='.shp' def findShapefiles(path): shapes = [] for root, dirs, files in os.walk(path): if len(files) == 0: continue DEBUG("Processing directory '%s' with %i files " % (root, len(files))) for f in files: idx = f.find(SHP) if (idx+len(SHP)) == len(f): shapes.append((f.replace(SHP, ''), root + "/" + f)) return shapes