[GRASS-SVN] r57491 - grass/trunk/lib/python/pygrass/gis
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Aug 23 10:02:04 PDT 2013
Author: zarch
Date: 2013-08-23 10:02:04 -0700 (Fri, 23 Aug 2013)
New Revision: 57491
Modified:
grass/trunk/lib/python/pygrass/gis/__init__.py
Log:
Fix writing and add methods
Modified: grass/trunk/lib/python/pygrass/gis/__init__.py
===================================================================
--- grass/trunk/lib/python/pygrass/gis/__init__.py 2013-08-23 11:39:55 UTC (rev 57490)
+++ grass/trunk/lib/python/pygrass/gis/__init__.py 2013-08-23 17:02:04 UTC (rev 57491)
@@ -349,12 +349,12 @@
return lns
def write(self, mapsets):
- with open(self.spath, "a+") as f:
+ with open(self.spath, "w+") as f:
ms = self.location.mapsets()
f.write('%s' % '\n'.join([m for m in mapsets if m in ms]))
def add(self, mapset):
- if mapset in self.location:
+ if mapset not in self.read() and mapset in self.location:
with open(self.spath, "a+") as f:
f.write('\n%s' % mapset)
else:
More information about the grass-commit
mailing list