Переглянути джерело

m.proj: use grass.separator and allow multi-character separators

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@60625 15284696-431f-4ddb-bdfa-cd5b030d7da7
Huidae Cho 11 роки тому
батько
коміт
c7e11150c3
1 змінених файлів з 2 додано та 29 видалено
  1. 2 29
      scripts/m.proj/m.proj.py

+ 2 - 29
scripts/m.proj/m.proj.py

@@ -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 @@ def main():
 	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')