[GRASS-SVN] r65103 - grass/branches/releasebranch_7_0/lib/python/temporal

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Apr 20 05:42:44 PDT 2015


Author: neteler
Date: 2015-04-20 05:42:44 -0700 (Mon, 20 Apr 2015)
New Revision: 65103

Modified:
   grass/branches/releasebranch_7_0/lib/python/temporal/c_libraries_interface.py
Log:
temporal library: Trying to partly fix #2337 (trunk r64470)

Modified: grass/branches/releasebranch_7_0/lib/python/temporal/c_libraries_interface.py
===================================================================
--- grass/branches/releasebranch_7_0/lib/python/temporal/c_libraries_interface.py	2015-04-20 11:59:11 UTC (rev 65102)
+++ grass/branches/releasebranch_7_0/lib/python/temporal/c_libraries_interface.py	2015-04-20 12:42:44 UTC (rev 65103)
@@ -148,35 +148,37 @@
 
        :returns: Names of available mapsets as list of strings
     """
-
-    mapsets = libgis.G_get_available_mapsets()
-
+    
     count = 0
     mapset_list = []
-    while mapsets[count]:
-        char_list = ""
-        mapset = mapsets[count]
-        if libgis.G_mapset_permissions(mapset) > 0:
+    try:
+        mapsets = libgis.G_get_available_mapsets()
+        while mapsets[count]:
+            char_list = ""
+            mapset = mapsets[count]
+            if libgis.G_mapset_permissions(mapset) > 0:
+                c = 0
+                while mapset[c] != "\x00":
+                    char_list += mapset[c]
+                    c += 1
+                mapset_list.append(char_list)
             count += 1
-            c = 0
-            while mapset[c] != "\x00":
-                char_list += mapset[c]
-                c += 1
 
-        mapset_list.append(char_list)
+        # We need to sort the mapset list, but the first one should be
+        # the current mapset
+        current_mapset = libgis.G_mapset()
+        if current_mapset in mapset_list:
+            mapset_list.remove(current_mapset)
+        mapset_list.sort()
+        mapset_list.reverse()
+        mapset_list.append(current_mapset)
+        mapset_list.reverse()
+    except:
+        raise
+    finally:
+        conn.send(mapset_list)
 
-    # We need to sort the mapset list, but the first one should be
-    # the current mapset
-    current_mapset = libgis.G_mapset()
-    mapset_list.remove(current_mapset)
-    mapset_list.sort()
-    mapset_list.reverse()
-    mapset_list.append(current_mapset)
-    mapset_list.reverse()
 
-    conn.send(mapset_list)
-
-
 def _has_timestamp(lock, conn, data):
     """Check if the file based GRASS timestamp is present and send
        True or False using the provided pipe.



More information about the grass-commit mailing list