[GRASS-SVN] r30231 - grass/trunk/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Feb 18 09:48:10 EST 2008


Author: martinl
Date: 2008-02-18 09:48:09 -0500 (Mon, 18 Feb 2008)
New Revision: 30231

Modified:
   grass/trunk/gui/wxpython/gui_modules/dbm.py
Log:
wxGUI: display error message for Attribute Table Manager when default DB settings is not set up

Modified: grass/trunk/gui/wxpython/gui_modules/dbm.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/dbm.py	2008-02-18 12:31:39 UTC (rev 30230)
+++ grass/trunk/gui/wxpython/gui_modules/dbm.py	2008-02-18 14:48:09 UTC (rev 30231)
@@ -160,7 +160,11 @@
         if len(self.itemCatsMap) > 0:
             keyId = -1
         else:
-            keyId = columnNames.index(keyColumn)
+            try:
+                # for maps connected via v.external
+                keyId = columnNames.index(keyColumn)
+            except:
+                keyId = -1
 
         i = 0
         info = wx.ListItem()
@@ -2009,6 +2013,11 @@
             elif item == 'database':
                 self.defaultDatabase = value
 
+        if len(self.defaultDriver) == 0 or \
+               len(self.defaultDatabase) == 0:
+            raise gcmd.GException(_('Unable to determine default DB connection settings. '
+                                   'Please define DB connection using db.connect module.'))
+        
         self.defaultTables = self.__getTables(self.defaultDriver, self.defaultDatabase)
         try:
             self.defaultColumns = self.__getColumns(self.defaultDriver, self.defaultDatabase,



More information about the grass-commit mailing list