[GRASS-SVN] r54594 - grass/trunk/lib/python/pygrass/gis
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Jan 11 08:38:31 PST 2013
Author: zarch
Date: 2013-01-11 08:38:31 -0800 (Fri, 11 Jan 2013)
New Revision: 54594
Modified:
grass/trunk/lib/python/pygrass/gis/__init__.py
Log:
Add pattern option in glist method of the Mapset class
Modified: grass/trunk/lib/python/pygrass/gis/__init__.py
===================================================================
--- grass/trunk/lib/python/pygrass/gis/__init__.py 2013-01-11 16:38:21 UTC (rev 54593)
+++ grass/trunk/lib/python/pygrass/gis/__init__.py 2013-01-11 16:38:31 UTC (rev 54594)
@@ -5,6 +5,7 @@
from os import listdir
from os.path import join
import ctypes as ct
+import fnmatch
from grass import script
#from grass.script import setup
@@ -238,7 +239,7 @@
def __repr__(self):
return 'Mapset(%r)' % self.name
- def glist(self, type):
+ def glist(self, type, pattern=None):
"""Return a list of grass types like:
* 'asciivect',
@@ -273,6 +274,8 @@
if el_name:
elist.append(el_name)
else:
+ if pattern:
+ return fnmatch.filter(elist, pattern)
return elist
More information about the grass-commit
mailing list