[GRASS-SVN] r45241 - in grass/trunk: . gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Jan 28 11:39:15 EST 2011


Author: martinl
Date: 2011-01-28 08:39:15 -0800 (Fri, 28 Jan 2011)
New Revision: 45241

Modified:
   grass/trunk/gui/wxpython/gui_modules/ghelp.py
   grass/trunk/translators.csv
Log:
wxGUI: fix translator.csv file + update ghelp.py to catch errors


Modified: grass/trunk/gui/wxpython/gui_modules/ghelp.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/ghelp.py	2011-01-28 16:37:37 UTC (rev 45240)
+++ grass/trunk/gui/wxpython/gui_modules/ghelp.py	2011-01-28 16:39:15 UTC (rev 45241)
@@ -38,6 +38,7 @@
 import gcmd
 import globalvar
 import gdialogs
+import utils
 
 class HelpFrame(wx.Frame):
     """!GRASS Quickstart help window"""
@@ -665,11 +666,22 @@
         if os.path.exists(contribfile):
             contribFile = open(contribfile, 'r')
             contribs = list()
+            errLines = list()
             for line in contribFile.readlines():
-                cvs_id, name, email, country, osgeo_id, rfc2_agreed = line.split(',')
+                line = line.rstrip('\n')
+                try:
+                    cvs_id, name, email, country, osgeo_id, rfc2_agreed = line.split(',')
+                except ValueError:
+                    errLines.append(line)
+                    continue
                 contribs.append((name, email, country, osgeo_id))
             contribs[0] = (_('Name'), _('E-mail'), _('Country'), _('OSGeo_ID'))
             contribFile.close()
+            
+            if errLines:
+                gcmd.GError(parent = self,
+                            message = _("Error when reading file '%s'.\n\nLines: %s") % \
+                                (translatorsfile, os.linesep.join(map (utils.UnicodeString, errLines))))
         else:
             contribs = None
         
@@ -704,13 +716,24 @@
         if os.path.exists(translatorsfile):
             translatorsFile = open(translatorsfile, 'r')
             translators = dict()
+            errLines = list()
             for line in translatorsFile.readlines()[1:]:
-                name, email, languages = line.rstrip('\n').split(',')
+                line = line.rstrip('\n')
+                try:
+                    name, email, languages = line.split(',')
+                except ValueError:
+                    errLines.append(line)
+                    continue
                 for language in languages.split(' '):
                     if not translators.has_key(language):
                         translators[language] = list()
                     translators[language].append((name, email))
             translatorsFile.close()
+            
+            if errLines:
+                gcmd.GError(parent = self,
+                            message = _("Error when reading file '%s'.\n\nLines: %s") % \
+                                (translatorsfile, os.linesep.join(map (utils.UnicodeString, errLines))))
         else:
             translators = None
         

Modified: grass/trunk/translators.csv
===================================================================
--- grass/trunk/translators.csv	2011-01-28 16:37:37 UTC (rev 45240)
+++ grass/trunk/translators.csv	2011-01-28 16:39:15 UTC (rev 45241)
@@ -59,7 +59,7 @@
 Aras.Gor.O Yalcin Yilmaz,<yilmazy istanbul.edu.tr>,TR
 Saban Safak,<ssafak cvm.com.tr>,TR
 Bui Huu Manh,<bhmanh73 yahoo.com>,VI
-Lê Quốc Thái, <lquocthai ioit.ac.vn>,VI
+Lê Quốc Thái,<lquocthai ioit.ac.vn>,VI
 Su Yongheng,<night2008 gmail.com>,ZH
 Zhang Jun,<nilarcs gmail.com>,ZH
 Shulin Yang,<shulin.yang.9 gmail.com>,ZH



More information about the grass-commit mailing list