diff roundup/cgi/form_parser.py @ 3491:0e5f15520e70

fix detection of "missing" existing values in CGI form parser [SF#1414149]
author Richard Jones <richard@users.sourceforge.net>
date Wed, 25 Jan 2006 02:24:28 +0000
parents 9ffea8719af1
children 4b80c330f02b
line wrap: on
line diff
--- a/roundup/cgi/form_parser.py	Tue Jan 24 08:30:49 2006 +0000
+++ b/roundup/cgi/form_parser.py	Wed Jan 25 02:24:28 2006 +0000
@@ -463,15 +463,18 @@
 
                 # "missing" existing values may not be None
                 if not existing:
-                    if isinstance(proptype, hyperdb.String) and not existing:
+                    if isinstance(proptype, hyperdb.String):
                         # some backends store "missing" Strings as empty strings
-                        existing = None
-                    elif isinstance(proptype, hyperdb.Number) and not existing:
+                        if existing == self.db.BACKEND_MISSING_STRING:
+                            existing = None
+                    elif isinstance(proptype, hyperdb.Number):
                         # some backends store "missing" Numbers as 0 :(
-                        existing = 0
-                    elif isinstance(proptype, hyperdb.Boolean) and not existing:
+                        if existing == self.db.BACKEND_MISSING_NUMBER:
+                            existing = None
+                    elif isinstance(proptype, hyperdb.Boolean):
                         # likewise Booleans
-                        existing = 0
+                        if existing == self.db.BACKEND_MISSING_BOOLEAN:
+                            existing = None
 
                 # if changed, set it
                 if value != existing:

Roundup Issue Tracker: http://roundup-tracker.org/