Jachym Cepicky 14 năm trước cách đây
mục cha
commit
023b4b2038
1 tập tin đã thay đổi với 6 bổ sung2 xóa
  1. 6 2
      OWS.py

+ 6 - 2
OWS.py

@@ -131,6 +131,8 @@ class OWS:
         dirname = os.path.join(self.config.get("Proxy4OWS","cachedir"),
                                 "%s-%s" % (self.service, md5.new(self.url).hexdigest()))
 
+        self.cachedir = dirname
+
         # get existing cache dir
         if not os.path.isdir(dirname):
             os.mkdir(dirname)
@@ -140,7 +142,6 @@ class OWS:
         else:
             logging.debug("Cachedir %s found" % dirname)
 
-        self.cachedir = dirname
 
         return self.cachedir
 
@@ -199,7 +200,10 @@ class OWS:
                 newCapsFile = open(os.path.join(self.cachedir,"capabilities.xml"),"w")
                 newCapsFile.write(newXml)
                 logging.debug("Capabilities unchanged, using existing mapfile %s" % self.getMapfileLocation())
-                return mapscript.mapObj(self.getMapfileLocation())
+                mapfilename = self.getMapfileLocation()
+                if os.path.exists(mapfilename):
+                    return mapscript.mapObj(mapfilename)
+                
 
         # finally