[GRASS-SVN] r55600 - grass/trunk/lib/python/pygrass/raster

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Apr 3 01:14:15 PDT 2013


Author: zarch
Date: 2013-04-03 01:14:15 -0700 (Wed, 03 Apr 2013)
New Revision: 55600

Modified:
   grass/trunk/lib/python/pygrass/raster/__init__.py
   grass/trunk/lib/python/pygrass/raster/abstract.py
Log:
Fix behaviour when instantiate a Raster class with name and mapset.

Modified: grass/trunk/lib/python/pygrass/raster/__init__.py
===================================================================
--- grass/trunk/lib/python/pygrass/raster/__init__.py	2013-04-03 08:14:00 UTC (rev 55599)
+++ grass/trunk/lib/python/pygrass/raster/__init__.py	2013-04-03 08:14:15 UTC (rev 55600)
@@ -103,8 +103,8 @@
 
 
     """
-    def __init__(self, name, *args, **kargs):
-        super(RasterRow, self).__init__(name, *args, **kargs)
+    def __init__(self, name, mapset='', *args, **kargs):
+        super(RasterRow, self).__init__(name, mapset, *args, **kargs)
 
     # mode = "r", method = "row",
     @must_be_open

Modified: grass/trunk/lib/python/pygrass/raster/abstract.py
===================================================================
--- grass/trunk/lib/python/pygrass/raster/abstract.py	2013-04-03 08:14:00 UTC (rev 55599)
+++ grass/trunk/lib/python/pygrass/raster/abstract.py	2013-04-03 08:14:15 UTC (rev 55600)
@@ -302,13 +302,13 @@
            True
         """
         if self.name:
-            self.mapset = functions.get_mapset_raster(self.name, self.mapset)
+            if self.mapset == '':
+                mapset = functions.get_mapset_raster(self.name, self.mapset)
+                self.mapset = mapset
+                return True
+            return bool(functions.get_mapset_raster(self.name, self.mapset))
         else:
             return False
-        if self.mapset:
-            return True
-        else:
-            return False
 
     def is_open(self):
         """Return True if the map is open False otherwise



More information about the grass-commit mailing list