[GRASS-SVN] r60625 - grass/trunk/scripts/m.proj

svn_grass at osgeo.org svn_grass at osgeo.org
Sat May 31 02:30:04 PDT 2014


Author: hcho
Date: 2014-05-31 02:30:04 -0700 (Sat, 31 May 2014)
New Revision: 60625

Modified:
   grass/trunk/scripts/m.proj/m.proj.py
Log:
m.proj: use grass.separator and allow multi-character separators

Modified: grass/trunk/scripts/m.proj/m.proj.py
===================================================================
--- grass/trunk/scripts/m.proj/m.proj.py	2014-05-31 09:28:11 UTC (rev 60624)
+++ grass/trunk/scripts/m.proj/m.proj.py	2014-05-31 09:30:04 UTC (rev 60625)
@@ -46,7 +46,6 @@
 #%end
 #%option G_OPT_F_SEP
 #% label: Field separator (format: input[,output])
-#% description: Valid field separators are also "space", "tab", or "comma"
 #% required : no
 #% guisection: Input coordinates
 #%end
@@ -159,34 +158,8 @@
 	except ValueError:
 	    ifs = ofs = fs
 
-    ifs = ifs.lower()
-    ofs = ofs.lower()
-    
-    if ifs in ('space', 'tab'):
-	ifs = ' '
-    elif ifs == 'comma':
-        ifs = ','
-    else:
-        if len(ifs) > 1:
-            grass.warning(_("Invalid field separator, using '%s'") % ifs[0])
-        try:
-            ifs = ifs[0]
-        except IndexError:
-            grass.fatal(_("Invalid field separator '%s'") % ifs)
-   
-    if ofs.lower() == 'space':
-        ofs = ' '
-    elif ofs.lower() == 'tab':
-        ofs = '\t'
-    elif ofs.lower() == 'comma':
-        ofs = ','
-    else:
-        if len(ofs) > 1:
-            grass.warning(_("Invalid field separator, using '%s'") % ofs[0])
-        try:
-            ofs = ofs[0]
-        except IndexError:
-            grass.fatal(_("Invalid field separator '%s'") % ifs)
+    ifs = grass.separator(ifs)
+    ofs = grass.separator(ofs)
 
     #### set up projection params
     s = grass.read_command("g.proj", flags='j')



More information about the grass-commit mailing list