[Dive4elements-commits] [PATCH] If we bother to check if the file is readable we might also

Wald Commits scm-commit at wald.intevation.org
Thu Feb 14 10:54:14 CET 2013


# HG changeset patch
# User Andre Heinecke <aheinecke at intevation.de>
# Date 1360835642 -3600
# Branch dami
# Node ID f4d61ac84b76e777878a64bdbe8c522f6c2deec1
# Parent  b5ac7588cf4d32d88ea9e200c324892699c0454b
If we bother to check if the file is readable we might also
bother to check if it's a file at all.

Thanks to teichmann for noticing

diff -r b5ac7588cf4d -r f4d61ac84b76 flys-backend/contrib/shpimporter/shpimporter.py
--- a/flys-backend/contrib/shpimporter/shpimporter.py	Wed Feb 13 19:11:34 2013 +0100
+++ b/flys-backend/contrib/shpimporter/shpimporter.py	Thu Feb 14 10:54:02 2013 +0100
@@ -231,7 +231,8 @@
         if not config.skip_dgm:
             dgmfilename = os.path.join(
                     config.directory, "..", "DGMs.csv")
-            if not os.access(dgmfilename, os.R_OK):
+            if not os.access(dgmfilename, os.R_OK) or not \
+                    os.path.isfile(dgmfilename):
                 INFO("Could not find or access DGM file: %s \n"
                      "Skipping DGM import." % dgmfilename)
             else:


More information about the Dive4elements-commits mailing list