浏览代码

wxGUI: fix modifying attributes (NULL values)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@50031 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 13 年之前
父节点
当前提交
55261a79eb
共有 1 个文件被更改,包括 20 次插入16 次删除
  1. 20 16
      gui/wxpython/dbmgr/dialogs.py

+ 20 - 16
gui/wxpython/dbmgr/dialogs.py

@@ -210,25 +210,29 @@ class DisplayAttributesDialog(wx.Dialog):
                         newvalue = self.FindWindowById(id).GetValue()
                     except:
                         newvalue = self.FindWindowById(id).GetLabel()
-                    
-                    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:
+                        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
                     
                     if newvalue != value:
                         updatedColumns.append(name)
-                        if newvalue is None:
+                        if not newvalue:
                             updatedValues.append('NULL')
                         else:
                             if ctype != str: