Bug fix: Handling of full paths in ancillary files. 0.8.1

2019-12-20

author
Iannis <i.binietoglou@impworks.gr>
date
Fri, 20 Dec 2019 14:36:21 +0200
changeset 40
8acea12976c4
parent 39
7f9605b75689
child 41
389f8f0baf52

Bug fix: Handling of full paths in ancillary files.

CHANGELOG.rst file | annotate | diff | comparison | revisions
scc_access/scc_access.py file | annotate | diff | comparison | revisions
--- a/CHANGELOG.rst	Thu Dec 19 18:03:16 2019 +0200
+++ b/CHANGELOG.rst	Fri Dec 20 14:36:21 2019 +0200
@@ -1,6 +1,14 @@
 Changelog
 =========
 
+0.8.1 - 2019-12-19
+------------------
+* Correct handling of ancillary file full paths (thanks to Marc-Antoine Drouin)
+
+0.8.0 - 2019-12-19
+------------------
+* Check if ancillary file is already in the SCC DB before uploading.
+
 0.7.1 - 2019-12-05
 ------------------
 * Fixed handling of both old- and new-style measurement ids.
--- a/scc_access/scc_access.py	Thu Dec 19 18:03:16 2019 +0200
+++ b/scc_access/scc_access.py	Fri Dec 20 14:36:21 2019 +0200
@@ -13,7 +13,7 @@
 from io import BytesIO
 import sys
 import time
-import urlparse
+
 from zipfile import ZipFile
 
 import yaml
@@ -472,7 +472,7 @@
 
         return measurement_id
 
-    def get_ancillary(self, filename, file_type):
+    def get_ancillary(self, file_path, file_type):
         """
         Try to get the ancillary file data from the SCC API.
 
@@ -480,8 +480,8 @@
 
         Parameters
         ----------
-        filename : str
-           Filename of the uploaded file.
+        file_path : str
+           Path  of the uploaded file.
         file_type : str
            Type of ancillary file. One of 'sounding', 'overlap', 'lidarratio'.
 
@@ -491,6 +491,8 @@
         """
         assert file_type in ['sounding', 'overlap', 'lidarratio']
 
+        filename = os.path.basename(file_path)
+
         if file_type == 'sounding':
             file_url = self.api_sounding_search_pattern.format(filename)
         elif file_type == 'overlap':

mercurial