[GRASS-SVN] r50031 - grass/trunk/gui/wxpython/dbmgr

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Jan 2 08:19:01 EST 2012


Author: martinl
Date: 2012-01-02 05:19:01 -0800 (Mon, 02 Jan 2012)
New Revision: 50031

Modified:
   grass/trunk/gui/wxpython/dbmgr/dialogs.py
Log:
wxGUI: fix modifying attributes (NULL values)


Modified: grass/trunk/gui/wxpython/dbmgr/dialogs.py
===================================================================
--- grass/trunk/gui/wxpython/dbmgr/dialogs.py	2012-01-02 02:45:10 UTC (rev 50030)
+++ grass/trunk/gui/wxpython/dbmgr/dialogs.py	2012-01-02 13:19:01 UTC (rev 50031)
@@ -210,25 +210,29 @@
                         newvalue = self.FindWindowById(id).GetValue()
                     except:
                         newvalue = self.FindWindowById(id).GetLabel()
+                  
+                    if newvalue:
+                        try:
+                            if ctype == int:
+                                newvalue = int(newvalue)
+                            elif ctype == float:
+                                newvalue = float(newvalue)
+                        except ValueError:
+                            GError(parent = self,
+                                   message = _("Column <%(col)s>: Value '%(value)s' needs to be entered as %(type)s.") % \
+                                       {'col' : name,
+                                        'value' : str(newvalue),
+                                        'type' : columns[name]['type'].lower()},
+                                   showTraceback = False)
+                            sqlCommands.append(None)
+                            continue
+                    else:
+                        if self.action == 'add':
+                            continue
                     
-                    try:
-                        if ctype == int:
-                            newvalue = int(newvalue)
-                        elif ctype == float:
-                            newvalue = float(newvalue)
-                    except ValueError:
-                        GError(parent = self,
-                               message = _("Column <%(col)s>: Value '%(value)s' needs to be entered as %(type)s.") % \
-                                   {'col' : name,
-                                    'value' : str(newvalue),
-                                    'type' : columns[name]['type'].lower()},
-                               showTraceback = False)
-                        sqlCommands.append(None)
-                        continue
-                    
                     if newvalue != value:
                         updatedColumns.append(name)
-                        if newvalue is None:
+                        if not newvalue:
                             updatedValues.append('NULL')
                         else:
                             if ctype != str:



More information about the grass-commit mailing list