Browse Source

Fix writing and add methods

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@57491 15284696-431f-4ddb-bdfa-cd5b030d7da7
Pietro Zambelli 11 years ago
parent
commit
aac19817dd
1 changed files with 2 additions and 2 deletions
  1. 2 2
      lib/python/pygrass/gis/__init__.py

+ 2 - 2
lib/python/pygrass/gis/__init__.py

@@ -349,12 +349,12 @@ class VisibleMapset(object):
         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: