- edited description
local caching needs to take care of wms url
Currently local caching does only take care about the URL parameters but not the URL itselfs.
One can fetch a lot of images and then change the URL to another one or even to some not existing.
Only get cabilities would enable to get different data.
So here we have two points to solve.
a) at the moment WMS Url becomes changed only get capabilties should be possible, all others should get inactive status
b) caching needs to take care of the Url used.
Comments (8)
-
reporter -
reporter - changed title to local caching needs to take care of wms url
-
reporter - changed milestone to 1.3.2
-
reporter This solves half of the issue and gives a hint what to do next
diff --git a/mslib/msui/wms_control.py b/mslib/msui/wms_control.py index 18c4b4d..13e964f 100644 --- a/mslib/msui/wms_control.py +++ b/mslib/msui/wms_control.py @@ -1228,19 +1228,23 @@ class WMSControlWidget(QtGui.QWidget, ui.Ui_WMSDockWidget): if self.cachingEnabled(): kwargs["return_only_url"] = True urlstr = self.wms.getmap(**kwargs) - kwargs["return_only_url"] = False - # Get an md5 digest of the URL string. The digest is used - # as the filename. - md5_filename = hashlib.md5(urlstr).hexdigest() - md5_filename += ".png" - logging.debug("checking cache for image file %s ...", - md5_filename) - md5_filename = os.path.join(self.wms_cache, md5_filename) - if os.path.exists(md5_filename): - logging.debug(" file exists, loading from cache.") - cache_hit = True + if urlstr.startswith(self.cbWMS_URL.currentText()): + kwargs["return_only_url"] = False + # Get an md5 digest of the URL string. The digest is used + # as the filename. + md5_filename = hashlib.md5(urlstr).hexdigest() + md5_filename += ".png" + logging.debug("checking cache for image file %s ...", + md5_filename) + md5_filename = os.path.join(self.wms_cache, md5_filename) + if os.path.exists(md5_filename): + logging.debug(" file exists, loading from cache.") + cache_hit = True + else: + logging.debug(" file does not exist, retrieving from WMS server.") else: - logging.debug(" file does not exist, retrieving from WMS server.") + logging.debug(" Url does not match, use get capabilities first.") + raise RuntimeError("Url does not match, use get capabilities first.") if not cache_hit:
-
reporter - changed milestone to 1.3.1
-
reporter The UI part review is also needed on many other views. So we have moved this to an other issue
#106 -
reporter - changed status to resolved
for using local cached images given wms url is verified, fixes
#107→ <<cset 00948a363c28>>
-
reporter Merged in ReimarBauer/mss (pull request #167)
for using local cached images given wms url is verified, fixes
#107→ <<cset d26f43f2dae6>>
- Log in to comment