[GRASS-SVN] r71336 - grass/trunk/lib/python/pygrass/gis

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Aug 7 06:27:56 PDT 2017


Author: zarch
Date: 2017-08-07 06:27:56 -0700 (Mon, 07 Aug 2017)
New Revision: 71336

Modified:
   grass/trunk/lib/python/pygrass/gis/__init__.py
Log:
pygrass: simplify logic in _check function

Modified: grass/trunk/lib/python/pygrass/gis/__init__.py
===================================================================
--- grass/trunk/lib/python/pygrass/gis/__init__.py	2017-08-07 13:01:44 UTC (rev 71335)
+++ grass/trunk/lib/python/pygrass/gis/__init__.py	2017-08-07 13:27:56 UTC (rev 71336)
@@ -66,14 +66,12 @@
              if value is empty return environmental variable
     :rtype: str
     """
-    if value and is_valid(value, path, type):
-        return value
-    elif value is '':
+    if value is '':
         from grass.pygrass.utils import getenv
         return getenv(type)
-    else:
-        raise GrassError("%s <%s> not found" % (type.title(),
-                                                join(path, value)))
+    if is_valid(value, path, type):
+        return value
+    raise GrassError("%s <%s> not found" % (type.title(), join(path, value)))
 
 
 def set_current_mapset(mapset, location=None, gisdbase=None):



More information about the grass-commit mailing list